scurrypy 0.4.2__py3-none-any.whl → 0.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of scurrypy might be problematic. Click here for more details.
- discord/__init__.py +219 -66
- discord/dispatch/command_dispatcher.py +10 -2
- discord/events/channel_events.py +1 -1
- discord/events/interaction_events.py +19 -7
- discord/http.py +1 -1
- discord/models/emoji.py +1 -1
- discord/models/interaction.py +5 -0
- discord/parts/channel.py +24 -2
- discord/parts/command.py +45 -57
- discord/parts/components.py +224 -0
- discord/parts/components_v2.py +77 -286
- discord/parts/embed.py +38 -109
- discord/parts/message.py +46 -103
- discord/parts/modal.py +9 -14
- discord/parts/role.py +1 -13
- discord/resources/channel.py +4 -4
- discord/resources/guild.py +0 -1
- discord/resources/interaction.py +20 -19
- discord/resources/message.py +10 -10
- {scurrypy-0.4.2.dist-info → scurrypy-0.5.dist-info}/METADATA +6 -13
- {scurrypy-0.4.2.dist-info → scurrypy-0.5.dist-info}/RECORD +24 -24
- discord/parts/action_row.py +0 -208
- {scurrypy-0.4.2.dist-info → scurrypy-0.5.dist-info}/WHEEL +0 -0
- {scurrypy-0.4.2.dist-info → scurrypy-0.5.dist-info}/licenses/LICENSE +0 -0
- {scurrypy-0.4.2.dist-info → scurrypy-0.5.dist-info}/top_level.txt +0 -0
discord/parts/message.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from typing import Optional, TypedDict, Unpack
|
|
3
|
-
from
|
|
4
|
-
from .embed import
|
|
5
|
-
from .
|
|
6
|
-
from .components_v2 import
|
|
2
|
+
from typing import Optional, TypedDict, Unpack
|
|
3
|
+
from ..model import DataModel
|
|
4
|
+
from .embed import EmbedPart
|
|
5
|
+
from .components import ActionRowPart
|
|
6
|
+
from .components_v2 import ContainerPart
|
|
7
7
|
|
|
8
8
|
class MessageFlags:
|
|
9
9
|
"""Flags that can be applied to a message."""
|
|
10
|
+
|
|
10
11
|
CROSSPOSTED = 1 << 0
|
|
11
12
|
"""Message has been published."""
|
|
12
13
|
|
|
@@ -26,7 +27,7 @@ class MessageFlags:
|
|
|
26
27
|
"""This message includes Discord's V2 Components."""
|
|
27
28
|
|
|
28
29
|
class MessageFlagParams(TypedDict, total=False):
|
|
29
|
-
"""Parameters for setting message flags."""
|
|
30
|
+
"""Parameters for setting message flags. See [`MessageFlags`][discord.parts.message.MessageFlags]."""
|
|
30
31
|
crossposted: bool
|
|
31
32
|
is_crosspost: bool
|
|
32
33
|
suppress_embeds: bool
|
|
@@ -34,19 +35,47 @@ class MessageFlagParams(TypedDict, total=False):
|
|
|
34
35
|
loading: bool
|
|
35
36
|
is_components_v2: bool
|
|
36
37
|
|
|
38
|
+
class MessageReferenceTypes:
|
|
39
|
+
"""Constants associated with how reference data is populated."""
|
|
40
|
+
|
|
41
|
+
DEFAULT = 0
|
|
42
|
+
"""Standard reference used by replies."""
|
|
43
|
+
|
|
44
|
+
FORWARD = 1
|
|
45
|
+
"""Reference used to point to a message at a point in time."""
|
|
46
|
+
|
|
37
47
|
@dataclass
|
|
38
|
-
class
|
|
48
|
+
class MessageReference(DataModel):
|
|
49
|
+
"""Represents the Message Reference object."""
|
|
50
|
+
|
|
39
51
|
message_id: int
|
|
52
|
+
"""ID of the originating message."""
|
|
53
|
+
|
|
40
54
|
channel_id: int
|
|
41
|
-
|
|
55
|
+
"""
|
|
56
|
+
Channel ID of the originating message.
|
|
57
|
+
!!! note
|
|
58
|
+
Optional for default type, but REQUIRED for forwards.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
type: int = MessageReferenceTypes.DEFAULT
|
|
62
|
+
"""Type of reference. Defaults to `DEFAULT`. See [`MessageReferenceTypes`][discord.parts.message.MessageReferenceTypes]."""
|
|
42
63
|
|
|
43
64
|
@dataclass
|
|
44
|
-
class
|
|
65
|
+
class Attachment(DataModel):
|
|
45
66
|
"""Represents an attachment."""
|
|
67
|
+
|
|
46
68
|
id: int
|
|
69
|
+
"""User-defined ID for the attachment."""
|
|
70
|
+
|
|
47
71
|
path: str
|
|
72
|
+
"""Relative path to the file."""
|
|
73
|
+
|
|
48
74
|
filename: str
|
|
75
|
+
"""Name of the file."""
|
|
76
|
+
|
|
49
77
|
description: str
|
|
78
|
+
"""Description of the file."""
|
|
50
79
|
|
|
51
80
|
def _to_dict(self):
|
|
52
81
|
return {
|
|
@@ -56,89 +85,27 @@ class _Attachment(DataModel):
|
|
|
56
85
|
}
|
|
57
86
|
|
|
58
87
|
@dataclass
|
|
59
|
-
class
|
|
88
|
+
class MessagePart(DataModel):
|
|
60
89
|
"""Describes expected params when editing/creating a message."""
|
|
61
90
|
|
|
62
91
|
content: Optional[str] = None
|
|
63
92
|
"""Message text content."""
|
|
64
93
|
|
|
65
94
|
flags: Optional[int] = 0
|
|
66
|
-
"""Message flags. See [`MessageFlags`][discord.parts.message.MessageFlags]
|
|
95
|
+
"""Message flags. See [`MessageFlags`][discord.parts.message.MessageFlags]."""
|
|
67
96
|
|
|
68
|
-
components: Optional[list[
|
|
97
|
+
components: Optional[list[ActionRowPart | ContainerPart]] = field(default_factory=list)
|
|
69
98
|
"""Components to be attached to this message."""
|
|
70
99
|
|
|
71
|
-
attachments: Optional[list[
|
|
100
|
+
attachments: Optional[list[Attachment]] = field(default_factory=list)
|
|
72
101
|
"""Attachments to be attached to this message."""
|
|
73
102
|
|
|
74
|
-
embeds: Optional[list[
|
|
103
|
+
embeds: Optional[list[EmbedPart]] = field(default_factory=list)
|
|
75
104
|
"""Embeds to be attached to this message."""
|
|
76
105
|
|
|
77
|
-
message_reference: Optional[
|
|
106
|
+
message_reference: Optional[MessageReference] = None
|
|
78
107
|
"""Message reference if reply."""
|
|
79
108
|
|
|
80
|
-
def add_row(self, row: ActionRow):
|
|
81
|
-
"""Add an action row to this message.
|
|
82
|
-
|
|
83
|
-
Args:
|
|
84
|
-
row (ActionRow): the ActionRow object
|
|
85
|
-
|
|
86
|
-
Returns:
|
|
87
|
-
(MessageBuilder): self
|
|
88
|
-
"""
|
|
89
|
-
self.components.append(row)
|
|
90
|
-
return self
|
|
91
|
-
|
|
92
|
-
def add_container(self, container: Container, *, has_container_boarder: bool = False):
|
|
93
|
-
"""Add a container to this message.
|
|
94
|
-
|
|
95
|
-
Args:
|
|
96
|
-
container (Container): the Container object.
|
|
97
|
-
has_container_boarder (bool, optional): If message should be contained in an Embed-like container. Defaults to False.
|
|
98
|
-
|
|
99
|
-
Returns:
|
|
100
|
-
(MessageBuilder): self
|
|
101
|
-
"""
|
|
102
|
-
if has_container_boarder:
|
|
103
|
-
self.components.append(container)
|
|
104
|
-
else:
|
|
105
|
-
self.components.extend(container.components)
|
|
106
|
-
return self
|
|
107
|
-
|
|
108
|
-
def add_embed(self, embed: EmbedBuilder):
|
|
109
|
-
"""Add an embed to this message.
|
|
110
|
-
|
|
111
|
-
Args:
|
|
112
|
-
embed (EmbedBuilder): The EmbedBuilder object.
|
|
113
|
-
|
|
114
|
-
Returns:
|
|
115
|
-
(MessageBuilder): self
|
|
116
|
-
"""
|
|
117
|
-
self.embeds.append(embed)
|
|
118
|
-
return self
|
|
119
|
-
|
|
120
|
-
def add_attachment(self, file_path: str, description: str = None):
|
|
121
|
-
"""Add an attachment to this message
|
|
122
|
-
|
|
123
|
-
Args:
|
|
124
|
-
file_path (str): full qualifying path to file
|
|
125
|
-
description (str, optional): file descriptor. Defaults to None.
|
|
126
|
-
|
|
127
|
-
Returns:
|
|
128
|
-
(MessageBuilder): self
|
|
129
|
-
"""
|
|
130
|
-
import os
|
|
131
|
-
|
|
132
|
-
self.attachments.append(
|
|
133
|
-
_Attachment(
|
|
134
|
-
id=len(self.attachments),
|
|
135
|
-
filename=os.path.basename(file_path),
|
|
136
|
-
path=file_path,
|
|
137
|
-
description=description
|
|
138
|
-
)
|
|
139
|
-
)
|
|
140
|
-
return self
|
|
141
|
-
|
|
142
109
|
def set_flags(self, **flags: Unpack[MessageFlagParams]):
|
|
143
110
|
"""Set this message's flags using MessageFlagParams.
|
|
144
111
|
|
|
@@ -149,7 +116,7 @@ class MessageBuilder(DataModel):
|
|
|
149
116
|
(ValueError): invalid flag
|
|
150
117
|
|
|
151
118
|
Returns:
|
|
152
|
-
(
|
|
119
|
+
(MessagePart): self
|
|
153
120
|
"""
|
|
154
121
|
_flag_map = {
|
|
155
122
|
'crossposted': MessageFlags.CROSSPOSTED,
|
|
@@ -167,28 +134,4 @@ class MessageBuilder(DataModel):
|
|
|
167
134
|
if value:
|
|
168
135
|
self.flags |= _flag_map[name]
|
|
169
136
|
|
|
170
|
-
return self
|
|
171
|
-
|
|
172
|
-
def _set_reference(self,
|
|
173
|
-
message_id: int,
|
|
174
|
-
channel_id: int,
|
|
175
|
-
ref_type: Literal['Default', 'Forward'] = 'Default'
|
|
176
|
-
):
|
|
177
|
-
"""Internal helper for setting this message's reference message. Used in replies.
|
|
178
|
-
|
|
179
|
-
Args:
|
|
180
|
-
message_id (int): message to reference
|
|
181
|
-
|
|
182
|
-
Returns:
|
|
183
|
-
(MessageBuilder): self
|
|
184
|
-
"""
|
|
185
|
-
_ref_types = {
|
|
186
|
-
'DEFAULT': 0,
|
|
187
|
-
'FORWARD': 1
|
|
188
|
-
}
|
|
189
|
-
self.message_reference = _MessageReference(
|
|
190
|
-
type=_ref_types.get(ref_type.upper()),
|
|
191
|
-
channel_id=channel_id,
|
|
192
|
-
message_id=message_id
|
|
193
|
-
)
|
|
194
|
-
return self
|
|
137
|
+
return self
|
discord/parts/modal.py
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from
|
|
2
|
+
from ..model import DataModel
|
|
3
3
|
from .components_v2 import Label
|
|
4
4
|
|
|
5
5
|
@dataclass
|
|
6
|
-
class
|
|
7
|
-
|
|
8
|
-
custom_id: str = None
|
|
9
|
-
components: list[Label] = field(default_factory=list)
|
|
6
|
+
class ModalPart(DataModel):
|
|
7
|
+
"""Represents the Modal object."""
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
title: str
|
|
10
|
+
"""Title of the popup modal."""
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
custom_id: str = None
|
|
13
|
+
"""ID for the modal."""
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"""
|
|
20
|
-
self.components.append(component)
|
|
21
|
-
return self
|
|
15
|
+
components: list[Label] = field(default_factory=list)
|
|
16
|
+
"""1 to 5 components that make up the modal."""
|
discord/parts/role.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Optional
|
|
3
|
-
from
|
|
3
|
+
from ..model import DataModel
|
|
4
4
|
|
|
5
5
|
from ..models.role import RoleColors
|
|
6
6
|
|
|
@@ -25,15 +25,3 @@ class Role(DataModel):
|
|
|
25
25
|
|
|
26
26
|
unicode_emoji: Optional[str] = None
|
|
27
27
|
"""Unicode emoji of the role."""
|
|
28
|
-
|
|
29
|
-
def set_color(self, hex: str):
|
|
30
|
-
"""Set this role's color with a hex. (format: #FFFFFF)
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
hex (str): color as a hex code
|
|
34
|
-
|
|
35
|
-
Returns:
|
|
36
|
-
(Role): self
|
|
37
|
-
"""
|
|
38
|
-
self.color=int(hex.strip('#'), 16)
|
|
39
|
-
return self
|
discord/resources/channel.py
CHANGED
|
@@ -6,7 +6,7 @@ from ..model import DataModel
|
|
|
6
6
|
from .message import Message
|
|
7
7
|
|
|
8
8
|
from ..parts.channel import GuildChannel
|
|
9
|
-
from ..parts.message import
|
|
9
|
+
from ..parts.message import MessagePart
|
|
10
10
|
|
|
11
11
|
class MessagesFetchParams(TypedDict, total=False):
|
|
12
12
|
"""Params when fetching guild channel messages."""
|
|
@@ -132,7 +132,7 @@ class Channel(DataModel):
|
|
|
132
132
|
|
|
133
133
|
return [Message.from_dict(msg, self._http) for msg in data]
|
|
134
134
|
|
|
135
|
-
async def send(self, message: str |
|
|
135
|
+
async def send(self, message: str | MessagePart):
|
|
136
136
|
"""
|
|
137
137
|
Send a message to this channel.
|
|
138
138
|
|
|
@@ -140,13 +140,13 @@ class Channel(DataModel):
|
|
|
140
140
|
* SEND_MESSAGES → required to create a message in this channel
|
|
141
141
|
|
|
142
142
|
Args:
|
|
143
|
-
message (str |
|
|
143
|
+
message (str | MessagePart): can be just text or the MessagePart for dynamic messages
|
|
144
144
|
|
|
145
145
|
Returns:
|
|
146
146
|
(Message): The created Message object
|
|
147
147
|
"""
|
|
148
148
|
if isinstance(message, str):
|
|
149
|
-
message =
|
|
149
|
+
message = MessagePart(content=message)
|
|
150
150
|
|
|
151
151
|
data = await self._http.request("POST", f"/channels/{self.id}/messages", data=message._to_dict())
|
|
152
152
|
|
discord/resources/guild.py
CHANGED
discord/resources/interaction.py
CHANGED
|
@@ -4,8 +4,8 @@ from typing import Optional, Unpack
|
|
|
4
4
|
from ..http import HTTPClient
|
|
5
5
|
from ..model import DataModel
|
|
6
6
|
|
|
7
|
-
from ..parts.modal import
|
|
8
|
-
from ..parts.message import
|
|
7
|
+
from ..parts.modal import ModalPart
|
|
8
|
+
from ..parts.message import MessagePart, MessageFlagParams
|
|
9
9
|
|
|
10
10
|
from ..models.guild import GuildModel
|
|
11
11
|
from ..models.member import MemberModel
|
|
@@ -38,8 +38,9 @@ class InteractionCallbackTypes:
|
|
|
38
38
|
"""Acknowledge an interaction and edit a response later. User sees a loading state."""
|
|
39
39
|
|
|
40
40
|
DEFERRED_UPDATE_MESSAGE = 6
|
|
41
|
-
"""
|
|
42
|
-
|
|
41
|
+
"""
|
|
42
|
+
Acknowledge an interaction and edit the original message later.
|
|
43
|
+
The user does NOT see a loading state. (Components only)
|
|
43
44
|
"""
|
|
44
45
|
|
|
45
46
|
UPDATE_MESSAGE = 7
|
|
@@ -68,7 +69,7 @@ class Interaction(DataModel):
|
|
|
68
69
|
"""HTTP session for requests."""
|
|
69
70
|
|
|
70
71
|
type: int
|
|
71
|
-
"""Type of interaction."""
|
|
72
|
+
"""Type of interaction. See [`InteractionTypes`][discord.dispatch.command_dispatcher.InteractionTypes]."""
|
|
72
73
|
|
|
73
74
|
channel_id: int
|
|
74
75
|
"""ID of the channel where the interaction was sent."""
|
|
@@ -97,20 +98,20 @@ class Interaction(DataModel):
|
|
|
97
98
|
channel: Optional[Channel] = None
|
|
98
99
|
"""Partial channel object the interaction was invoked."""
|
|
99
100
|
|
|
100
|
-
async def respond(self, message: str |
|
|
101
|
+
async def respond(self, message: str | MessagePart, with_response: bool = False, **flags: Unpack[MessageFlagParams]):
|
|
101
102
|
"""Create a message in response to an interaction.
|
|
102
103
|
|
|
103
104
|
Args:
|
|
104
|
-
message (str |
|
|
105
|
+
message (str | MessagePart): content as a string or from MessagePart
|
|
105
106
|
with_response (bool, optional): if the interaction data should be returned. Defaults to False.
|
|
106
107
|
|
|
107
108
|
Raises:
|
|
108
109
|
TypeError: invalid type
|
|
109
110
|
"""
|
|
110
111
|
if isinstance(message, str):
|
|
111
|
-
message =
|
|
112
|
-
elif not isinstance(message,
|
|
113
|
-
raise TypeError(f"Interaction.respond expects type str or
|
|
112
|
+
message = MessagePart(content=message).set_flags(**flags)
|
|
113
|
+
elif not isinstance(message, MessagePart):
|
|
114
|
+
raise TypeError(f"Interaction.respond expects type str or MessagePart, got {type(message).__name__}")
|
|
114
115
|
|
|
115
116
|
content = {
|
|
116
117
|
'type': InteractionCallbackTypes.CHANNEL_MESSAGE_WITH_SOURCE,
|
|
@@ -129,19 +130,19 @@ class Interaction(DataModel):
|
|
|
129
130
|
if with_response:
|
|
130
131
|
return InteractionCallbackModel.from_dict(data, self._http)
|
|
131
132
|
|
|
132
|
-
async def update(self, message: str |
|
|
133
|
+
async def update(self, message: str | MessagePart, **flags: Unpack[MessageFlagParams]):
|
|
133
134
|
"""Update a message in response to an interaction.
|
|
134
135
|
|
|
135
136
|
Args:
|
|
136
|
-
message (str |
|
|
137
|
+
message (str | MessagePart): content as a string or from MessagePart
|
|
137
138
|
|
|
138
139
|
Raises:
|
|
139
140
|
TypeError: invalid type
|
|
140
141
|
"""
|
|
141
142
|
if isinstance(message, str):
|
|
142
|
-
message =
|
|
143
|
-
elif not isinstance(message,
|
|
144
|
-
raise TypeError(f"Interaction.update expects type str or
|
|
143
|
+
message = MessagePart(content=message).set_flags(**flags)
|
|
144
|
+
elif not isinstance(message, MessagePart):
|
|
145
|
+
raise TypeError(f"Interaction.update expects type str or MessagePart, got {type(message).__name__}")
|
|
145
146
|
|
|
146
147
|
content = {
|
|
147
148
|
'type': InteractionCallbackTypes.UPDATE_MESSAGE,
|
|
@@ -154,17 +155,17 @@ class Interaction(DataModel):
|
|
|
154
155
|
data=content,
|
|
155
156
|
files=[fp.path for fp in message.attachments])
|
|
156
157
|
|
|
157
|
-
async def respond_modal(self, modal:
|
|
158
|
+
async def respond_modal(self, modal: ModalPart):
|
|
158
159
|
"""Create a modal in response to an interaction.
|
|
159
160
|
|
|
160
161
|
Args:
|
|
161
|
-
modal (
|
|
162
|
+
modal (ModalPart): modal data
|
|
162
163
|
|
|
163
164
|
Raises:
|
|
164
165
|
TypeError: invalid type
|
|
165
166
|
"""
|
|
166
|
-
if not isinstance(modal,
|
|
167
|
-
raise TypeError(f"Interaction.respond_modal expects type
|
|
167
|
+
if not isinstance(modal, ModalPart):
|
|
168
|
+
raise TypeError(f"Interaction.respond_modal expects type ModalPart, got {type(modal).__name__}")
|
|
168
169
|
|
|
169
170
|
content = {
|
|
170
171
|
'type': InteractionCallbackTypes.MODAL,
|
discord/resources/message.py
CHANGED
|
@@ -6,7 +6,7 @@ from ..model import DataModel
|
|
|
6
6
|
|
|
7
7
|
from ..models.user import UserModel
|
|
8
8
|
from ..models.emoji import EmojiModel
|
|
9
|
-
from ..parts.message import
|
|
9
|
+
from ..parts.message import MessagePart
|
|
10
10
|
|
|
11
11
|
@dataclass
|
|
12
12
|
class Message(DataModel):
|
|
@@ -50,20 +50,20 @@ class Message(DataModel):
|
|
|
50
50
|
|
|
51
51
|
return Message.from_dict(data, self._http)
|
|
52
52
|
|
|
53
|
-
async def send(self, message: str |
|
|
53
|
+
async def send(self, message: str | MessagePart):
|
|
54
54
|
"""Sends a new message to the current channel.
|
|
55
55
|
|
|
56
56
|
Permissions:
|
|
57
57
|
* SEND_MESSAGES → required to senf your own messages
|
|
58
58
|
|
|
59
59
|
Args:
|
|
60
|
-
message (str |
|
|
60
|
+
message (str | MessagePart): can be just text or the MessagePart for dynamic messages
|
|
61
61
|
|
|
62
62
|
Returns:
|
|
63
63
|
(Message): the new Message object with all fields populated
|
|
64
64
|
"""
|
|
65
65
|
if isinstance(message, str):
|
|
66
|
-
message =
|
|
66
|
+
message = MessagePart(content=message)
|
|
67
67
|
|
|
68
68
|
data = await self._http.request(
|
|
69
69
|
"POST",
|
|
@@ -73,17 +73,17 @@ class Message(DataModel):
|
|
|
73
73
|
)
|
|
74
74
|
return Message.from_dict(data, self._http)
|
|
75
75
|
|
|
76
|
-
async def edit(self, message: str |
|
|
76
|
+
async def edit(self, message: str | MessagePart):
|
|
77
77
|
"""Edits this message.
|
|
78
78
|
|
|
79
79
|
Permissions:
|
|
80
80
|
* MANAGE_MESSAGES → ONLY if editing another user's message
|
|
81
81
|
|
|
82
82
|
Args:
|
|
83
|
-
message (str |
|
|
83
|
+
message (str | MessagePart): can be just text or the MessagePart for dynamic messages
|
|
84
84
|
"""
|
|
85
85
|
if isinstance(message, str):
|
|
86
|
-
message =
|
|
86
|
+
message = MessagePart(content=message)
|
|
87
87
|
|
|
88
88
|
data = await self._http.request(
|
|
89
89
|
"PATCH",
|
|
@@ -93,17 +93,17 @@ class Message(DataModel):
|
|
|
93
93
|
|
|
94
94
|
self._update(data)
|
|
95
95
|
|
|
96
|
-
async def reply(self, message: str |
|
|
96
|
+
async def reply(self, message: str | MessagePart):
|
|
97
97
|
"""Reply to this message with a new message.
|
|
98
98
|
|
|
99
99
|
Permissions:
|
|
100
100
|
* SEND_MESSAGES → required to send the message
|
|
101
101
|
|
|
102
102
|
Args:
|
|
103
|
-
message (str |
|
|
103
|
+
message (str | MessagePart): the new message
|
|
104
104
|
"""
|
|
105
105
|
if isinstance(message, str):
|
|
106
|
-
message =
|
|
106
|
+
message = MessagePart(content=message)
|
|
107
107
|
|
|
108
108
|
message = message._set_reference(self.id, self.channel_id)
|
|
109
109
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scurrypy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5
|
|
4
4
|
Summary: Dataclass-driven Discord API Wrapper in Python
|
|
5
5
|
Author: Furmissile
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -8,7 +8,7 @@ Description-Content-Type: text/markdown
|
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Dynamic: license-file
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# __ScurryPy__
|
|
12
12
|
|
|
13
13
|
[](https://badge.fury.io/py/scurrypy)
|
|
14
14
|
|
|
@@ -20,22 +20,16 @@ A dataclass-driven Discord API wrapper in Python!
|
|
|
20
20
|
|
|
21
21
|
While this wrapper is mainly used for various squirrel-related shenanigans, it can also be used for more generic bot purposes.
|
|
22
22
|
|
|
23
|
-
---
|
|
24
|
-
|
|
25
23
|
## Features
|
|
26
24
|
* Command and event handling
|
|
27
25
|
* Declarative style using decorators
|
|
28
26
|
* Supports both legacy and new features
|
|
29
27
|
* Respects Discord’s rate limits
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## Some Things to Consider...
|
|
29
|
+
## Notes & Early Status
|
|
34
30
|
* This is an early version — feedback, ideas, and contributions are very welcome! That said, there may be bumps along the way, so expect occasional bugs and quirks.
|
|
35
31
|
* Certain features are not yet supported, while others are intentionally omitted. See the [docs](https://furmissile.github.io/scurrypy) for full details.
|
|
36
32
|
|
|
37
|
-
---
|
|
38
|
-
|
|
39
33
|
## Getting Started
|
|
40
34
|
*Note: This section also appears in the documentation, but here are complete examples ready to use with your bot credentials.*
|
|
41
35
|
|
|
@@ -58,7 +52,7 @@ load_dotenv(dotenv_path='./path/to/env')
|
|
|
58
52
|
|
|
59
53
|
client = discord.Client(
|
|
60
54
|
token=os.getenv("DISCORD_TOKEN"),
|
|
61
|
-
application_id=APPLICATION_ID #
|
|
55
|
+
application_id=APPLICATION_ID # your bot’s application ID
|
|
62
56
|
)
|
|
63
57
|
|
|
64
58
|
@client.command(
|
|
@@ -84,7 +78,7 @@ load_dotenv(dotenv_path='./path/to/env')
|
|
|
84
78
|
|
|
85
79
|
client = discord.Client(
|
|
86
80
|
token=os.getenv("DISCORD_TOKEN"),
|
|
87
|
-
application_id=APPLICATION_ID
|
|
81
|
+
application_id=APPLICATION_ID # your bot’s application ID
|
|
88
82
|
intents=discord.set_intents(message_content=True),
|
|
89
83
|
prefix='!' # your custom prefix
|
|
90
84
|
)
|
|
@@ -126,5 +120,4 @@ If you plan to make substantial changes or release your own variant:
|
|
|
126
120
|
See the [License](./LICENSE) for details.
|
|
127
121
|
|
|
128
122
|
## Like What You See?
|
|
129
|
-
|
|
130
|
-
for more examples, guides, and API reference!
|
|
123
|
+
Explore the full [documentation](https://furmissile.github.io/scurrypy) for more examples, guides, and API reference.
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
discord/__init__.py,sha256=
|
|
1
|
+
discord/__init__.py,sha256=A6xThHIt5sokb0eWiRxJAs0e_XOSrdMgoOO8Qf73f_g,10246
|
|
2
2
|
discord/client.py,sha256=feTk5CXgYEMeV9bd3ahz2TcrjqtjRElVRBGU6wwzaoY,14225
|
|
3
3
|
discord/client_like.py,sha256=JyJq0XBq0vKuPBJ_ZnYf5yAAuX1zz_2B1TZBQE-BYbQ,473
|
|
4
4
|
discord/config.py,sha256=OH1A2mNKhDlGvQYASEsVUx2pNxP1YQ2a7a7z-IM5xFg,200
|
|
5
5
|
discord/error.py,sha256=AlislRTna554cM6KC0KrwKugzYDYtx_9C8_3QFe4XDc,2070
|
|
6
6
|
discord/gateway.py,sha256=L0SE7N29rg02JtNv670JMbw8LMLvtEsLF4LPM33OlHM,5110
|
|
7
|
-
discord/http.py,sha256=
|
|
7
|
+
discord/http.py,sha256=ynpfECHEXtJSGz6RE3ZwGjD33ErD6WkqkEUHmP5kl_o,7894
|
|
8
8
|
discord/intents.py,sha256=Lf2fogFFDqilZeKJv7tcUgKmMW3D7ykK4bBNi-zDzYA,2866
|
|
9
9
|
discord/logger.py,sha256=7lks8VyU538nUr_OfiUXRFOtXlpOLZSLvLoDRxJ8loY,4929
|
|
10
10
|
discord/model.py,sha256=CmuxyoWLWokE_UvCQ9M7U9Cr7JH9R7ULMv9KMwzXjDQ,3105
|
|
11
11
|
discord/dispatch/__init__.py,sha256=m7ixrbNhOV9QRORXPw6LSwxofQMAvLmPFBweBZu9ACc,20
|
|
12
|
-
discord/dispatch/command_dispatcher.py,sha256=
|
|
12
|
+
discord/dispatch/command_dispatcher.py,sha256=mefZVq1dvU7pLOfJxP8V8zetveuavtzRYdcMQ9Ts8WM,6292
|
|
13
13
|
discord/dispatch/event_dispatcher.py,sha256=0hX4oSQloxColXNxPT2iWnqi4S9VKTxyD9_MSPsVYUM,3769
|
|
14
14
|
discord/dispatch/prefix_dispatcher.py,sha256=HXgL5XqrQK08iJ4G_SgsLuC-s0YoH3FlqPY_bR6JLlQ,2115
|
|
15
15
|
discord/events/__init__.py,sha256=xE8YtJ7NKZkm7MLnohDQIbezh3ColmLR-3BMiZabt3k,18
|
|
16
|
-
discord/events/channel_events.py,sha256=
|
|
16
|
+
discord/events/channel_events.py,sha256=EnhrdcuS6ZgmAD2czZGP3q77ghaAB12JyUi6ZeTQGlY,1567
|
|
17
17
|
discord/events/guild_events.py,sha256=Ok9tW3tjcwtbiqJgbe-42d9-R3-2RzqmIgBHEP-2Pcc,896
|
|
18
18
|
discord/events/hello_event.py,sha256=O8Ketu_N943cnGaFkGsAHfWhgKXFQCYCqSD3EqdsXjA,225
|
|
19
|
-
discord/events/interaction_events.py,sha256=
|
|
19
|
+
discord/events/interaction_events.py,sha256=mx-u_VTV4DNvzIfd-hIIpVAFdIeQySa9BNWAsyAA7Ns,4731
|
|
20
20
|
discord/events/message_events.py,sha256=M5xdaJH1zRzdZk0oN0Jykaeu9k09EjgZjeiIT_EkL1A,1475
|
|
21
21
|
discord/events/reaction_events.py,sha256=xx7GD-fqakhJmS-X-HbuAUg9pg6Gqo_KRtLTdPJu7UE,2643
|
|
22
22
|
discord/events/ready_event.py,sha256=c3Pf4ndNYV2byuliADi8pUxpuvKXa9FLKNz_uzIWGso,794
|
|
23
23
|
discord/models/__init__.py,sha256=ZKhFO5eX4GbTRdvi4CU4z2hO-HQU29WZw2x4DujvARY,18
|
|
24
24
|
discord/models/application.py,sha256=2sXtRysUc2TJ40FjdcrWgosmwMrp_h3ybddubQMixKM,924
|
|
25
|
-
discord/models/emoji.py,sha256=
|
|
25
|
+
discord/models/emoji.py,sha256=CneXdbMu4Jjr2ewJ8ur3XH7MboCQxx10zdrwYdF7szw,930
|
|
26
26
|
discord/models/guild.py,sha256=aXUByOUUIGt9d2qIGC6_X_vh0Nyib8Iqj5ZElBeNV_I,819
|
|
27
27
|
discord/models/integration.py,sha256=V29RO2925mQbVXPAMt665cML3m8mJACYmdJLWwbbUyE,612
|
|
28
|
-
discord/models/interaction.py,sha256=
|
|
28
|
+
discord/models/interaction.py,sha256=arej3iBcgUn6X--mXe0s91xs22v2NBLlI5bEqdRrbOU,899
|
|
29
29
|
discord/models/member.py,sha256=pkI-NVRMb3hUBkxI26FSYZxzx2mRNGXOeWWCw3BGGsY,705
|
|
30
30
|
discord/models/role.py,sha256=erlERmK-IZz4YzSNY-XLNvCc-Z5PoVlClxPOX67dQJg,1169
|
|
31
31
|
discord/models/user.py,sha256=lgG6GoU_7L68oHt6PGTzTkU1vrbsclRQzGjKzsLBeKA,298
|
|
32
32
|
discord/parts/__init__.py,sha256=yROb-BqEw-FKXqq_-0WbP33U-Arm_9NpJuEamXpvjeA,19
|
|
33
|
-
discord/parts/
|
|
34
|
-
discord/parts/
|
|
35
|
-
discord/parts/command.py,sha256=CPyPO_T5ULp7j7syF9z2LztP3SF6KyX89sodz2c40Aw,2924
|
|
33
|
+
discord/parts/channel.py,sha256=CbOs-m6pPlI0hJ-avI4GlZq8qt85lebDuwcRv4pVwy4,1193
|
|
34
|
+
discord/parts/command.py,sha256=remhqq4F90ffwdX4pa0Rtn5_ZfvIzX4R1jv1_1Mh8o8,2317
|
|
36
35
|
discord/parts/component_types.py,sha256=qr1R0jzXpE_h9Xv4P5DyYRSuhxS0Qnm9aag-JKrJvBA,131
|
|
37
|
-
discord/parts/
|
|
38
|
-
discord/parts/
|
|
39
|
-
discord/parts/
|
|
40
|
-
discord/parts/
|
|
41
|
-
discord/parts/
|
|
36
|
+
discord/parts/components.py,sha256=qBWUu7cuqMzBhyB7qYBp8p04cRUzibcHVL4tIWKl4Wk,7754
|
|
37
|
+
discord/parts/components_v2.py,sha256=THOBdHSpaoLqXBYY0KV8lz36mIY59id_x5FIRrFvR_o,5471
|
|
38
|
+
discord/parts/embed.py,sha256=-K6MqBB0r1GlGHJQtAVIQ6FcTnncYccIGY6sRPHuVsc,2056
|
|
39
|
+
discord/parts/message.py,sha256=1aJg6LsZidHK3Lw2RgpsU9beuWTMlDAcTS1yIUMy5HQ,4140
|
|
40
|
+
discord/parts/modal.py,sha256=u7M01oLMkBJP1P6QUvciYWVMEXHvmLw1AnG_jHxbg-w,417
|
|
41
|
+
discord/parts/role.py,sha256=X4snTtLgluhvt10nUM9j5MveVpn9fh5AIgsIgImA_U4,627
|
|
42
42
|
discord/resources/__init__.py,sha256=EdzYKftSLqqr3Bpzc0_90kfozJXOtp9jNTIHhCTt_-0,21
|
|
43
43
|
discord/resources/application.py,sha256=vYMTli_FSbC7venMepsJ9bkzdEQVkKYpnxCJ9K2XDho,2765
|
|
44
44
|
discord/resources/bot_emojis.py,sha256=RvGCSOBkjS39P2aab0FzYUOTzBOiHX99RLrJZzAYNiU,1701
|
|
45
|
-
discord/resources/channel.py,sha256=
|
|
46
|
-
discord/resources/guild.py,sha256=
|
|
47
|
-
discord/resources/interaction.py,sha256=
|
|
48
|
-
discord/resources/message.py,sha256=
|
|
45
|
+
discord/resources/channel.py,sha256=sAGUMY-Cui6L8nrIiYBW_vSQ4rYOjGz-SeoJn3_P-zk,6905
|
|
46
|
+
discord/resources/guild.py,sha256=EwUhOzdfHi09fFjYoFeTeCGPZ-Pu4d441GddvdaHhko,8198
|
|
47
|
+
discord/resources/interaction.py,sha256=rNp5QBDOs0Rfpi2XcGSAFgJ67nOMOJ1AeYdglx7-G2A,6009
|
|
48
|
+
discord/resources/message.py,sha256=SbsgbnK6cCo_iblWet1WrlcZ-Gp9PC4OkPgVIFHHe0A,7506
|
|
49
49
|
discord/resources/user.py,sha256=vk89TnCVi-6ZgbDs_TZTCXrx_NfFS5Q9Wi_itYoaoyg,3085
|
|
50
|
-
scurrypy-0.
|
|
51
|
-
scurrypy-0.
|
|
52
|
-
scurrypy-0.
|
|
53
|
-
scurrypy-0.
|
|
54
|
-
scurrypy-0.
|
|
50
|
+
scurrypy-0.5.dist-info/licenses/LICENSE,sha256=qIlBETYpSEU8glbiwiJbuDxVl-2WIuf1PDqJemMjKkc,792
|
|
51
|
+
scurrypy-0.5.dist-info/METADATA,sha256=zb4AsEmg2xnS0GFz5FS06QK-MUnhUC8wNLTPikUDfJg,4744
|
|
52
|
+
scurrypy-0.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
53
|
+
scurrypy-0.5.dist-info/top_level.txt,sha256=fJkrNbR-_8ubMBUcDEJBcfkpECrvSEmMrNKgvLlQFoM,8
|
|
54
|
+
scurrypy-0.5.dist-info/RECORD,,
|