scurrypy 0.4__py3-none-any.whl → 0.6.6__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.
Files changed (72) hide show
  1. scurrypy/__init__.py +429 -0
  2. scurrypy/client.py +335 -0
  3. {discord → scurrypy}/client_like.py +8 -1
  4. scurrypy/dispatch/command_dispatcher.py +205 -0
  5. {discord → scurrypy}/dispatch/event_dispatcher.py +21 -21
  6. {discord → scurrypy}/dispatch/prefix_dispatcher.py +31 -12
  7. {discord → scurrypy}/error.py +6 -18
  8. {discord → scurrypy}/events/channel_events.py +2 -1
  9. scurrypy/events/gateway_events.py +31 -0
  10. {discord → scurrypy}/events/guild_events.py +2 -1
  11. {discord → scurrypy}/events/interaction_events.py +28 -13
  12. {discord → scurrypy}/events/message_events.py +8 -5
  13. {discord → scurrypy}/events/reaction_events.py +1 -2
  14. {discord → scurrypy}/events/ready_event.py +1 -3
  15. scurrypy/gateway.py +183 -0
  16. scurrypy/http.py +310 -0
  17. {discord → scurrypy}/intents.py +5 -7
  18. {discord → scurrypy}/logger.py +14 -61
  19. scurrypy/model.py +71 -0
  20. scurrypy/models.py +258 -0
  21. scurrypy/parts/channel.py +42 -0
  22. scurrypy/parts/command.py +90 -0
  23. scurrypy/parts/components.py +224 -0
  24. scurrypy/parts/components_v2.py +144 -0
  25. scurrypy/parts/embed.py +83 -0
  26. scurrypy/parts/message.py +134 -0
  27. scurrypy/parts/modal.py +16 -0
  28. {discord → scurrypy}/parts/role.py +2 -14
  29. {discord → scurrypy}/resources/application.py +1 -2
  30. {discord → scurrypy}/resources/bot_emojis.py +1 -1
  31. {discord → scurrypy}/resources/channel.py +9 -8
  32. {discord → scurrypy}/resources/guild.py +14 -16
  33. {discord → scurrypy}/resources/interaction.py +50 -43
  34. {discord → scurrypy}/resources/message.py +15 -16
  35. {discord → scurrypy}/resources/user.py +3 -4
  36. scurrypy-0.6.6.dist-info/METADATA +108 -0
  37. scurrypy-0.6.6.dist-info/RECORD +47 -0
  38. {scurrypy-0.4.dist-info → scurrypy-0.6.6.dist-info}/licenses/LICENSE +1 -1
  39. scurrypy-0.6.6.dist-info/top_level.txt +1 -0
  40. discord/__init__.py +0 -223
  41. discord/client.py +0 -375
  42. discord/dispatch/command_dispatcher.py +0 -163
  43. discord/gateway.py +0 -155
  44. discord/http.py +0 -280
  45. discord/model.py +0 -90
  46. discord/models/__init__.py +0 -1
  47. discord/models/application.py +0 -37
  48. discord/models/emoji.py +0 -34
  49. discord/models/guild.py +0 -35
  50. discord/models/integration.py +0 -23
  51. discord/models/interaction.py +0 -26
  52. discord/models/member.py +0 -27
  53. discord/models/role.py +0 -53
  54. discord/models/user.py +0 -15
  55. discord/parts/action_row.py +0 -208
  56. discord/parts/channel.py +0 -20
  57. discord/parts/command.py +0 -102
  58. discord/parts/components_v2.py +0 -353
  59. discord/parts/embed.py +0 -154
  60. discord/parts/message.py +0 -194
  61. discord/parts/modal.py +0 -21
  62. scurrypy-0.4.dist-info/METADATA +0 -130
  63. scurrypy-0.4.dist-info/RECORD +0 -54
  64. scurrypy-0.4.dist-info/top_level.txt +0 -1
  65. {discord → scurrypy}/config.py +0 -0
  66. {discord → scurrypy}/dispatch/__init__.py +0 -0
  67. {discord → scurrypy}/events/__init__.py +0 -0
  68. {discord → scurrypy}/events/hello_event.py +0 -0
  69. {discord → scurrypy}/parts/__init__.py +0 -0
  70. {discord → scurrypy}/parts/component_types.py +0 -0
  71. {discord → scurrypy}/resources/__init__.py +0 -0
  72. {scurrypy-0.4.dist-info → scurrypy-0.6.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,144 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import Optional
3
+ from ..model import DataModel
4
+
5
+ from .component_types import *
6
+
7
+ class ComponentV2Types:
8
+ SECTION = 9
9
+ TEXT_DISPLAY = 10
10
+ THUMBNAIL = 11
11
+ MEDIA_GALLERY = 12
12
+ FILE = 13
13
+ SEPARATOR = 14
14
+ CONTAINER = 17
15
+ LABEL = 18
16
+
17
+ @dataclass
18
+ class SectionPart(DataModel, ContainerChild):
19
+ """Represents the Section component."""
20
+
21
+ accessory: Optional[SectionAccessory] = None
22
+ """A component that is contextually associated to the content of the section."""
23
+
24
+ components: list[SectionChild] = field(default_factory=list)
25
+ """Component(s) representing the content of the section that is contextually associated to the accessory."""
26
+
27
+ type: int = field(init=False, default=ComponentV2Types.SECTION)
28
+ """Component type. Always `ComponentV2Types.SECTION` for this class. See [`ComponentV2Types`][scurrypy.parts.components_v2.ComponentV2Types]."""
29
+
30
+ @dataclass
31
+ class TextDisplay(DataModel, ContainerChild, SectionChild):
32
+ """Represents the Text Display component."""
33
+
34
+ content: str
35
+ """Text that will be displayed similar to a message."""
36
+
37
+ type: int = field(init=False, default=ComponentV2Types.TEXT_DISPLAY)
38
+ """Component type. Always `ComponentV2Types.TEXT_DISPLAY` for this class. See [`ComponentV2Types`][scurrypy.parts.components_v2.ComponentV2Types]."""
39
+
40
+ @dataclass
41
+ class Thumbnail(DataModel, SectionAccessory):
42
+ """Represents the Thumbnail component."""
43
+
44
+ media: str
45
+ """Media of the thumbnail. http or attachment://<filename> scheme."""
46
+
47
+ description: Optional[str] = None
48
+ """Description for the media."""
49
+
50
+ spoiler: Optional[bool] = False
51
+ """Whether the thumbnail should be a spoiler (or blurred out)."""
52
+
53
+ type: int = field(init=False, default=ComponentV2Types.THUMBNAIL)
54
+ """Component type. Always `ComponentV2Types.THUMBNAIL` for this class. See [`ComponentV2Types`][scurrypy.parts.components_v2.ComponentV2Types]."""
55
+
56
+ @dataclass
57
+ class MediaGalleryItem(DataModel):
58
+ """Represents the Media Gallery Item component."""
59
+
60
+ media: str
61
+ """Image data. http or attachment://<filename> scheme."""
62
+
63
+ description: Optional[str] = None
64
+ """Alt text for the media."""
65
+
66
+ spoiler: Optional[bool] = False
67
+ """Whether the thumbnail should be a spoiler (or blurred out)."""
68
+
69
+ @dataclass
70
+ class MediaGallery(DataModel, ContainerChild):
71
+ """Represents the Media Gallery component."""
72
+
73
+ items: list[MediaGalleryItem] = field(default_factory=list)
74
+ """1 to 10 nedia gallery items. See [`MediaGalleryItem`][scurrypy.parts.components_v2.MediaGalleryItem]."""
75
+
76
+ type: int = field(init=False, default=ComponentV2Types.MEDIA_GALLERY)
77
+ """Component type. Always `ComponentV2Types.MEDIA_GALLERY` for this class. See [`ComponentV2Types`][scurrypy.parts.components_v2.ComponentV2Types]."""
78
+
79
+ @dataclass
80
+ class File(DataModel, ContainerChild):
81
+ """Represents the File component."""
82
+
83
+ file: str
84
+ """File name. ONLY supports attachment://<filename> scheme."""
85
+
86
+ spoiler: Optional[bool] = False
87
+ """Whether the thumbnail should be a spoiler (or blurred out)."""
88
+
89
+ type: int = field(init=False, default=ComponentV2Types.FILE)
90
+ """Component type. Always `ComponentV2Types.File` for this class. See [`ComponentV2Types`][scurrypy.parts.components_v2.ComponentV2Types]."""
91
+
92
+ class SeparatorTypes:
93
+ """Represents separator types constants."""
94
+
95
+ SMALL_PADDING = 1
96
+ """Small separator padding."""
97
+
98
+ LARGE_PADDING = 2
99
+ """Large separator padding."""
100
+
101
+ @dataclass
102
+ class Separator(DataModel, ContainerChild):
103
+ """Represents the Separator component."""
104
+
105
+ divider: bool = True
106
+ """Whether a visual divider should be displayed in the component. Defaults to True."""
107
+
108
+ spacing: Optional[int] = SeparatorTypes.SMALL_PADDING
109
+ """Size of separator padding. Defaults to `SMALL_PADDING`. See [`SeparatorTypes`][scurrypy.parts.components_v2.SeparatorTypes]."""
110
+
111
+ type: int = field(init=False, default=ComponentV2Types.SEPARATOR)
112
+ """Component type. Always `ComponentV2Types.SEPARATOR` for this class. See [`ComponentV2Types`][scurrypy.parts.components_v2.ComponentV2Types]."""
113
+
114
+ @dataclass
115
+ class ContainerPart(DataModel):
116
+ """Represents a container of display and interactable components."""
117
+
118
+ components: list[ContainerChild] = field(default_factory=list)
119
+ """Child components that are encapsulated within the Container."""
120
+
121
+ accent_color: Optional[int] = None
122
+ """Color for the accent as an integer."""
123
+
124
+ spoiler: Optional[bool] = False
125
+ """If the container should be blurred out. Defaults to False."""
126
+
127
+ type: int = field(init=False, default=ComponentV2Types.CONTAINER)
128
+ """Component type. Always `ComponentV2Types.CONTAINER` for this class. See [`ComponentV2Types`][scurrypy.parts.components_v2.ComponentV2Types]."""
129
+
130
+ @dataclass
131
+ class Label(DataModel):
132
+ """Represents the Discord Label component."""
133
+
134
+ label: str
135
+ """Label text."""
136
+
137
+ component: LabelChild = None
138
+ """A component within the label."""
139
+
140
+ description: Optional[str] = None
141
+ """An optional description text for the label."""
142
+
143
+ type: int = field(init=False, default=ComponentV2Types.LABEL)
144
+ """Component type. Always `ComponentV2Types.LABEL` for this class. See [`ComponentV2Types`][scurrypy.parts.components_v2.ComponentV2Types]."""
@@ -0,0 +1,83 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import Optional
3
+ from ..model import DataModel
4
+
5
+ @dataclass
6
+ class EmbedAuthor(DataModel):
7
+ """Embed author parameters."""
8
+
9
+ name: str
10
+ """Name of the author."""
11
+
12
+ url: Optional[str] = None
13
+ """URL of the author. http or attachment://<filename> scheme."""
14
+
15
+ icon_url: Optional[str] = None
16
+ """URL of author's icon. http or attachment://<filename> scheme."""
17
+
18
+ @dataclass
19
+ class EmbedThumbnail(DataModel):
20
+ """Embed thumbnail."""
21
+
22
+ url: str
23
+ """Thumbnail content. http or attachment://<filename> scheme."""
24
+
25
+ @dataclass
26
+ class EmbedField(DataModel):
27
+ """Embed field."""
28
+
29
+ name: str
30
+ """Name of the field."""
31
+
32
+ value: str
33
+ """Value of the field."""
34
+
35
+ inline: Optional[bool] = None
36
+ """Whether or not this field should display inline."""
37
+
38
+ @dataclass
39
+ class EmbedImage(DataModel):
40
+ """Embed image."""
41
+
42
+ url: str
43
+ """Image content. http or attachment://<filename> scheme."""
44
+
45
+ @dataclass
46
+ class EmbedFooter(DataModel):
47
+ """Embed footer."""
48
+ text: str
49
+ """Footer text."""
50
+
51
+ icon_url: Optional[str] = None
52
+ """URL of the footer icon. http or attachment://<filename> scheme."""
53
+
54
+ @dataclass
55
+ class EmbedPart(DataModel):
56
+ """Represents the Embed portion of a message."""
57
+
58
+ title: Optional[str] = None
59
+ """This embed's title."""
60
+
61
+ description: Optional[str] = None
62
+ """This embed's description."""
63
+
64
+ timestamp: Optional[str] = None
65
+ """Timestamp of when the embed was sent."""
66
+
67
+ color: Optional[int] = None
68
+ """Embed's accent color."""
69
+
70
+ author: Optional[EmbedAuthor] = None
71
+ """Embed's author."""
72
+
73
+ thumbnail: Optional[EmbedThumbnail] = None
74
+ """Embed's thumbnail attachment."""
75
+
76
+ image: Optional[EmbedImage] = None
77
+ """Embed's image attachment."""
78
+
79
+ fields: Optional[list[EmbedField]] = field(default_factory=list)
80
+ """List of embed's fields."""
81
+
82
+ footer: Optional[EmbedFooter] = None
83
+ """Embed's footer."""
@@ -0,0 +1,134 @@
1
+ from dataclasses import dataclass, field
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
+
8
+ class MessageFlags:
9
+ """Flags that can be applied to a message."""
10
+
11
+ CROSSPOSTED = 1 << 0
12
+ """Message has been published."""
13
+
14
+ IS_CROSSPOST = 1 << 1
15
+ """Message originated from another channel."""
16
+
17
+ SUPPRESS_EMBEDS = 1 << 2
18
+ """Hide embeds (if any)."""
19
+
20
+ EPHEMERAL = 1 << 6
21
+ """Only visible to the invoking user."""
22
+
23
+ LOADING = 1 << 7
24
+ """Thinking response."""
25
+
26
+ IS_COMPONENTS_V2 = 1 << 15
27
+ """This message includes Discord's V2 Components."""
28
+
29
+ class MessageFlagParams(TypedDict, total=False):
30
+ """Parameters for setting message flags. See [`MessageFlags`][scurrypy.parts.message.MessageFlags]."""
31
+ crossposted: bool
32
+ is_crosspost: bool
33
+ suppress_embeds: bool
34
+ ephemeral: bool
35
+ loading: bool
36
+ is_components_v2: bool
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
+
47
+ @dataclass
48
+ class MessageReference(DataModel):
49
+ """Represents the Message Reference object."""
50
+
51
+ message_id: int
52
+ """ID of the originating message."""
53
+
54
+ channel_id: int
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`][scurrypy.parts.message.MessageReferenceTypes]."""
63
+
64
+ @dataclass
65
+ class Attachment(DataModel):
66
+ """Represents an attachment."""
67
+
68
+ id: int = field(init=False)
69
+ """ID of the attachment (internally set)."""
70
+
71
+ path: str
72
+ """Relative path to the file."""
73
+
74
+ description: str
75
+ """Description of the file."""
76
+
77
+ def to_dict(self):
78
+ return {
79
+ 'id': self.id,
80
+ 'filename': self.path.split('/')[-1],
81
+ 'description': self.description
82
+ }
83
+
84
+ @dataclass
85
+ class MessagePart(DataModel):
86
+ """Describes expected params when editing/creating a message."""
87
+
88
+ content: Optional[str] = None
89
+ """Message text content."""
90
+
91
+ flags: Optional[int] = 0
92
+ """Message flags. See [`MessageFlags`][scurrypy.parts.message.MessageFlags]."""
93
+
94
+ components: Optional[list[ActionRowPart | ContainerPart]] = field(default_factory=list)
95
+ """Components to be attached to this message."""
96
+
97
+ attachments: Optional[list[Attachment]] = field(default_factory=list)
98
+ """Attachments to be attached to this message."""
99
+
100
+ embeds: Optional[list[EmbedPart]] = field(default_factory=list)
101
+ """Embeds to be attached to this message."""
102
+
103
+ message_reference: Optional[MessageReference] = None
104
+ """Message reference if reply."""
105
+
106
+ def set_flags(self, **flags: Unpack[MessageFlagParams]):
107
+ """Set this message's flags using MessageFlagParams.
108
+
109
+ Args:
110
+ **flags (Unpack[MessageFlagParams]): message flags to set. (set respective flag to True to toggle.)
111
+
112
+ Raises:
113
+ (ValueError): invalid flag
114
+
115
+ Returns:
116
+ (MessagePart): self
117
+ """
118
+ _flag_map = {
119
+ 'crossposted': MessageFlags.CROSSPOSTED,
120
+ 'is_crosspost': MessageFlags.IS_CROSSPOST,
121
+ 'suppress_embeds': MessageFlags.SUPPRESS_EMBEDS,
122
+ 'ephemeral': MessageFlags.EPHEMERAL,
123
+ 'loading': MessageFlags.LOADING,
124
+ 'is_components_v2': MessageFlags.IS_COMPONENTS_V2,
125
+ }
126
+
127
+ # each flag maps to a specific bit position!
128
+ for name, value in flags.items():
129
+ if name not in _flag_map:
130
+ raise ValueError(f"Invalid flag: {name}")
131
+ if value:
132
+ self.flags |= _flag_map[name]
133
+
134
+ return self
@@ -0,0 +1,16 @@
1
+ from dataclasses import dataclass, field
2
+ from ..model import DataModel
3
+ from .components_v2 import Label
4
+
5
+ @dataclass
6
+ class ModalPart(DataModel):
7
+ """Represents the Modal object."""
8
+
9
+ title: str
10
+ """Title of the popup modal."""
11
+
12
+ custom_id: str = None
13
+ """ID for the modal."""
14
+
15
+ components: list[Label] = field(default_factory=list)
16
+ """1 to 5 components that make up the modal."""
@@ -1,8 +1,8 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import Optional
3
- from discord.model import DataModel
3
+ from ..model import DataModel
4
4
 
5
- from ..models.role import RoleColors
5
+ from ..models import RoleColors
6
6
 
7
7
  @dataclass
8
8
  class Role(DataModel):
@@ -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
@@ -4,8 +4,7 @@ from typing import Optional
4
4
  from ..http import HTTPClient
5
5
  from ..model import DataModel
6
6
 
7
- from ..models.user import UserModel
8
- from ..models.guild import GuildModel
7
+ from ..models import UserModel, GuildModel
9
8
 
10
9
  class ApplicationFlags:
11
10
  """Application flags (bitwise constants)."""
@@ -1,5 +1,5 @@
1
1
  from ..http import HTTPClient
2
- from ..models.emoji import EmojiModel
2
+ from ..models import EmojiModel
3
3
 
4
4
  class BotEmojis:
5
5
  """Represents a collection of the bot's emojis."""
@@ -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 MessageBuilder
9
+ from ..parts.message import MessagePart
10
10
 
11
11
  class MessagesFetchParams(TypedDict, total=False):
12
12
  """Params when fetching guild channel messages."""
@@ -118,7 +118,7 @@ class Channel(DataModel):
118
118
  * READ_MESSAGE_HISTORY → required for user, otherwise no messages are returned
119
119
 
120
120
  Args:
121
- **kwargs: field-specific data
121
+ **kwargs: message fetch params
122
122
  !!! note
123
123
  if no kwargs are provided, default to 50 fetched messages limit.
124
124
 
@@ -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 | MessageBuilder):
135
+ async def send(self, message: str | MessagePart):
136
136
  """
137
137
  Send a message to this channel.
138
138
 
@@ -140,15 +140,15 @@ class Channel(DataModel):
140
140
  * SEND_MESSAGES → required to create a message in this channel
141
141
 
142
142
  Args:
143
- message (str | MessageBuilder): can be just text or the MessageBuilder for dynamic messages
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 = MessageBuilder(content=message)
149
+ message = MessagePart(content=message)
150
150
 
151
- data = await self._http.request("POST", f"/channels/{self.id}/messages", message._to_dict())
151
+ data = await self._http.request("POST", f"/channels/{self.id}/messages", data=message.to_dict())
152
152
 
153
153
  return Message.from_dict(data, self._http)
154
154
 
@@ -164,7 +164,7 @@ class Channel(DataModel):
164
164
  Returns:
165
165
  (Channel): The updated channel object
166
166
  """
167
- data = await self._http.request("PATCH", f"/channels/{self.id}", data=channel._to_dict())
167
+ data = await self._http.request("PATCH", f"/channels/{self.id}", data=channel.to_dict())
168
168
  self._update(data)
169
169
 
170
170
  return self
@@ -175,6 +175,7 @@ class Channel(DataModel):
175
175
  Args:
176
176
  message_id: ID of message to attach thread
177
177
  name (str): thread name
178
+ **kwargs (Unpack[ThreadFromMessageParams]): thread create params
178
179
 
179
180
  Returns:
180
181
  (Channel): The updated channel object
@@ -197,7 +198,7 @@ class Channel(DataModel):
197
198
  * READ_MESSAGE_HISTORY → required for reading pinned messages
198
199
 
199
200
  Args:
200
- kwargs: field-specific data
201
+ **kwargs: pinned message fetch params
201
202
  !!! note
202
203
  If no kwargs are provided, default to 50 fetched messages limit.
203
204
 
@@ -9,9 +9,7 @@ from .channel import Channel
9
9
  from ..parts.channel import GuildChannel
10
10
  from ..parts.role import Role
11
11
 
12
- from ..models.emoji import EmojiModel
13
- from ..models.member import MemberModel
14
- from ..models.role import RoleModel
12
+ from ..models import EmojiModel, MemberModel, RoleModel
15
13
 
16
14
  class FetchGuildMembersParams(TypedDict, total=False):
17
15
  """Params when fetching guild members."""
@@ -20,7 +18,7 @@ class FetchGuildMembersParams(TypedDict, total=False):
20
18
  """Max number of members to return Range 1 - 1000. Default 1."""
21
19
 
22
20
  after: int
23
- """Highest user id in previous page."""
21
+ """Highest user ID in previous page."""
24
22
 
25
23
  class FetchGuildParams(TypedDict, total=False):
26
24
  """Params when fetching a guild."""
@@ -101,7 +99,7 @@ class Guild(DataModel):
101
99
  """Fetch the Guild object by the given ID.
102
100
 
103
101
  Args:
104
- kwargs: field-specific data
102
+ **kwargs: guild fetch params
105
103
  !!! note
106
104
  If no kwargs are provided, default to with_counts = False
107
105
 
@@ -136,7 +134,7 @@ class Guild(DataModel):
136
134
  Returns:
137
135
  (Channel): the created channel
138
136
  """
139
- data = await self._http.request('POST', f'/guilds/{self.id}/channels', channel._to_dict())
137
+ data = await self._http.request('POST', f'/guilds/{self.id}/channels', data=channel.to_dict())
140
138
 
141
139
  return Channel.from_dict(data, self._http)
142
140
 
@@ -146,7 +144,7 @@ class Guild(DataModel):
146
144
  Requires the GUILD_MEMBERS privileged intent!
147
145
 
148
146
  Args:
149
- user_id (int): user id of the member to fetch
147
+ user_id (int): user ID of the member to fetch
150
148
 
151
149
  Returns:
152
150
  (MemberModel): member's data
@@ -161,7 +159,7 @@ class Guild(DataModel):
161
159
  Requires the GUILD_MEMBERS privileged intent!
162
160
 
163
161
  Args:
164
- **kwargs: field-specific data
162
+ **kwargs: guild members fetch params
165
163
  !!! note
166
164
  If no kwargs are provided, default to 1 guild member limit.
167
165
 
@@ -181,8 +179,8 @@ class Guild(DataModel):
181
179
  * MANAGE_ROLES → required to add a role to the user
182
180
 
183
181
  Args:
184
- user_id (int): id of the member for the role
185
- role_id (int): id of the role to append
182
+ user_id (int): ID of the member for the role
183
+ role_id (int): ID of the role to append
186
184
  """
187
185
  await self._http.request('PUT', f'/guilds/{self.id}/members/{user_id}/roles/{role_id}')
188
186
 
@@ -193,8 +191,8 @@ class Guild(DataModel):
193
191
  * MANAGE_ROLES → required to remove a role from the user
194
192
 
195
193
  Args:
196
- user_id (int): id of the member with the role
197
- role_id (int): id of the role to remove
194
+ user_id (int): ID of the member with the role
195
+ role_id (int): ID of the role to remove
198
196
  """
199
197
  await self._http.request('DELETE', f'/guilds/{self.id}/members/{user_id}/roles/{role_id}')
200
198
 
@@ -202,7 +200,7 @@ class Guild(DataModel):
202
200
  """Fetch a role in this guild.
203
201
 
204
202
  Args:
205
- role_id (int): id of the role to fetch
203
+ role_id (int): ID of the role to fetch
206
204
 
207
205
  Returns:
208
206
  (RoleModel): fetched role's data
@@ -233,7 +231,7 @@ class Guild(DataModel):
233
231
  Returns:
234
232
  (RoleModel): new role data
235
233
  """
236
- data = await self._http.request('POST', f'/guilds/{self.id}/roles', role._to_dict())
234
+ data = await self._http.request('POST', f'/guilds/{self.id}/roles', data=role.to_dict())
237
235
 
238
236
  return RoleModel.from_dict(data)
239
237
 
@@ -249,7 +247,7 @@ class Guild(DataModel):
249
247
  Returns:
250
248
  (RoleModel): role with changes
251
249
  """
252
- data = await self._http.request('PATCH', f'/guilds/{self.id}/roles/{role_id}', role._to_dict())
250
+ data = await self._http.request('PATCH', f'/guilds/{self.id}/roles/{role_id}', data=role.to_dict())
253
251
 
254
252
  return RoleModel.from_dict(data)
255
253
 
@@ -260,6 +258,6 @@ class Guild(DataModel):
260
258
  * MANAGE_ROLES → required to delete a role in the guild
261
259
 
262
260
  Args:
263
- role_id (int): id of role to delete
261
+ role_id (int): ID of role to delete
264
262
  """
265
263
  await self._http.request('DELETE', f'/guilds/{self.id}/roles/{role_id}')