0
# Discord Objects and Entities
1
2
Comprehensive representation of Discord's object model including guilds, channels, messages, users, members, roles, and all their associated properties and methods. These classes provide the core data structures for interacting with Discord's API.
3
4
## Capabilities
5
6
### Guilds (Servers)
7
8
Discord guilds represent servers - communities with channels, members, roles, and various settings.
9
10
```python { .api }
11
class Guild:
12
"""
13
Represents a Discord guild (server).
14
"""
15
16
@property
17
def id(self) -> int:
18
"""The guild's ID."""
19
20
@property
21
def name(self) -> str:
22
"""The guild's name."""
23
24
@property
25
def description(self) -> Optional[str]:
26
"""The guild's description."""
27
28
@property
29
def icon(self) -> Optional[Asset]:
30
"""The guild's icon."""
31
32
@property
33
def banner(self) -> Optional[Asset]:
34
"""The guild's banner."""
35
36
@property
37
def owner_id(self) -> int:
38
"""The ID of the guild owner."""
39
40
@property
41
def owner(self) -> Optional[Member]:
42
"""The guild owner."""
43
44
@property
45
def member_count(self) -> int:
46
"""The number of members in the guild."""
47
48
@property
49
def members(self) -> List[Member]:
50
"""A list of guild members."""
51
52
@property
53
def channels(self) -> List[GuildChannel]:
54
"""A list of guild channels."""
55
56
@property
57
def text_channels(self) -> List[TextChannel]:
58
"""A list of text channels."""
59
60
@property
61
def voice_channels(self) -> List[VoiceChannel]:
62
"""A list of voice channels."""
63
64
@property
65
def categories(self) -> List[CategoryChannel]:
66
"""A list of category channels."""
67
68
@property
69
def threads(self) -> List[Thread]:
70
"""A list of threads in the guild."""
71
72
@property
73
def roles(self) -> List[Role]:
74
"""A list of guild roles."""
75
76
@property
77
def emojis(self) -> List[Emoji]:
78
"""A list of custom emojis."""
79
80
@property
81
def stickers(self) -> List[GuildSticker]:
82
"""A list of guild stickers."""
83
84
@property
85
def verification_level(self) -> VerificationLevel:
86
"""The guild's verification level."""
87
88
@property
89
def default_notifications(self) -> NotificationLevel:
90
"""Default notification level."""
91
92
@property
93
def explicit_content_filter(self) -> ContentFilter:
94
"""Explicit content filter level."""
95
96
def get_channel(self, channel_id: int) -> Optional[GuildChannel]:
97
"""Get a channel by ID."""
98
99
def get_member(self, user_id: int) -> Optional[Member]:
100
"""Get a member by user ID."""
101
102
def get_role(self, role_id: int) -> Optional[Role]:
103
"""Get a role by ID."""
104
105
async def create_text_channel(
106
self,
107
name: str,
108
*,
109
category: Optional[CategoryChannel] = None,
110
position: int = None,
111
topic: str = None,
112
slowmode_delay: int = None,
113
nsfw: bool = None,
114
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = None,
115
**kwargs
116
) -> TextChannel:
117
"""
118
Create a text channel.
119
120
Parameters:
121
- name: str - Channel name
122
- category: CategoryChannel - Parent category
123
- position: int - Channel position
124
- topic: str - Channel topic
125
- slowmode_delay: int - Slowmode delay in seconds
126
- nsfw: bool - Whether the channel is NSFW
127
- overwrites: Dict - Permission overwrites
128
"""
129
130
async def create_voice_channel(
131
self,
132
name: str,
133
*,
134
category: Optional[CategoryChannel] = None,
135
position: int = None,
136
bitrate: int = None,
137
user_limit: int = None,
138
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = None,
139
**kwargs
140
) -> VoiceChannel:
141
"""
142
Create a voice channel.
143
144
Parameters:
145
- name: str - Channel name
146
- category: CategoryChannel - Parent category
147
- position: int - Channel position
148
- bitrate: int - Voice bitrate
149
- user_limit: int - Maximum users
150
- overwrites: Dict - Permission overwrites
151
"""
152
153
async def create_category(
154
self,
155
name: str,
156
*,
157
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = None,
158
position: int = None,
159
**kwargs
160
) -> CategoryChannel:
161
"""Create a category channel."""
162
163
async def create_forum_channel(
164
self,
165
name: str,
166
*,
167
category: Optional[CategoryChannel] = None,
168
topic: str = None,
169
position: int = None,
170
slowmode_delay: int = None,
171
nsfw: bool = None,
172
available_tags: List[ForumTag] = None,
173
default_reaction_emoji: Union[str, Emoji, PartialEmoji] = None,
174
**kwargs
175
) -> ForumChannel:
176
"""Create a forum channel."""
177
178
async def create_role(
179
self,
180
*,
181
name: str = "new role",
182
permissions: Permissions = None,
183
color: Union[Colour, int] = None,
184
hoist: bool = None,
185
mentionable: bool = None,
186
**kwargs
187
) -> Role:
188
"""
189
Create a role.
190
191
Parameters:
192
- name: str - Role name
193
- permissions: Permissions - Role permissions
194
- color: Union[Colour, int] - Role color
195
- hoist: bool - Whether the role is hoisted
196
- mentionable: bool - Whether the role is mentionable
197
"""
198
199
async def ban(
200
self,
201
user: Union[User, Member, Object],
202
*,
203
reason: str = None,
204
delete_message_days: int = None,
205
delete_message_seconds: int = None
206
) -> None:
207
"""Ban a user from the guild."""
208
209
async def unban(self, user: Union[User, Object], *, reason: str = None) -> None:
210
"""Unban a user from the guild."""
211
212
async def kick(self, user: Member, *, reason: str = None) -> None:
213
"""Kick a member from the guild."""
214
215
async def edit(
216
self,
217
*,
218
name: str = None,
219
description: str = None,
220
icon: bytes = None,
221
banner: bytes = None,
222
**kwargs
223
) -> Guild:
224
"""Edit the guild."""
225
226
async def leave(self) -> None:
227
"""Leave the guild."""
228
229
async def delete(self) -> None:
230
"""Delete the guild (owner only)."""
231
232
class PartialInviteGuild:
233
"""Partial guild information from an invite."""
234
235
@property
236
def id(self) -> int: ...
237
@property
238
def name(self) -> str: ...
239
@property
240
def icon(self) -> Optional[Asset]: ...
241
@property
242
def banner(self) -> Optional[Asset]: ...
243
```
244
245
### Channels
246
247
Different types of communication channels within Discord guilds.
248
249
```python { .api }
250
class TextChannel:
251
"""
252
Represents a Discord text channel.
253
"""
254
255
@property
256
def id(self) -> int:
257
"""The channel's ID."""
258
259
@property
260
def name(self) -> str:
261
"""The channel's name."""
262
263
@property
264
def guild(self) -> Guild:
265
"""The guild this channel belongs to."""
266
267
@property
268
def topic(self) -> Optional[str]:
269
"""The channel's topic."""
270
271
@property
272
def position(self) -> int:
273
"""The channel's position."""
274
275
@property
276
def category(self) -> Optional[CategoryChannel]:
277
"""The category this channel belongs to."""
278
279
@property
280
def slowmode_delay(self) -> int:
281
"""Slowmode delay in seconds."""
282
283
@property
284
def nsfw(self) -> bool:
285
"""Whether the channel is NSFW."""
286
287
@property
288
def last_message_id(self) -> Optional[int]:
289
"""The ID of the last message."""
290
291
@property
292
def last_message(self) -> Optional[Message]:
293
"""The last message sent in the channel."""
294
295
async def send(
296
self,
297
content: str = None,
298
*,
299
tts: bool = False,
300
embed: Embed = None,
301
embeds: List[Embed] = None,
302
file: File = None,
303
files: List[File] = None,
304
view: View = None,
305
allowed_mentions: AllowedMentions = None,
306
reference: Union[Message, MessageReference] = None,
307
mention_author: bool = None,
308
suppress_embeds: bool = False,
309
silent: bool = False,
310
**kwargs
311
) -> Message:
312
"""
313
Send a message to the channel.
314
315
Parameters:
316
- content: str - Message content
317
- tts: bool - Whether the message uses text-to-speech
318
- embed: Embed - Rich embed
319
- embeds: List[Embed] - List of embeds
320
- file: File - File attachment
321
- files: List[File] - Multiple file attachments
322
- view: View - UI components
323
- allowed_mentions: AllowedMentions - Mention settings
324
- reference: Message - Message to reply to
325
- mention_author: bool - Whether to mention the author when replying
326
- suppress_embeds: bool - Whether to suppress embeds
327
- silent: bool - Whether the message should not trigger notifications
328
"""
329
330
async def fetch_message(self, id: int) -> Message:
331
"""Fetch a message by ID."""
332
333
def history(
334
self,
335
*,
336
limit: int = 100,
337
before: Union[Snowflake, datetime] = None,
338
after: Union[Snowflake, datetime] = None,
339
around: Union[Snowflake, datetime] = None,
340
oldest_first: bool = None
341
) -> HistoryIterator:
342
"""
343
Returns an async iterator for message history.
344
345
Parameters:
346
- limit: int - Maximum messages to retrieve
347
- before: Snowflake - Get messages before this message/time
348
- after: Snowflake - Get messages after this message/time
349
- around: Snowflake - Get messages around this message/time
350
- oldest_first: bool - Whether to get oldest messages first
351
"""
352
353
async def purge(
354
self,
355
*,
356
limit: int = 100,
357
check: Callable[[Message], bool] = None,
358
before: Union[Snowflake, datetime] = None,
359
after: Union[Snowflake, datetime] = None,
360
around: Union[Snowflake, datetime] = None,
361
oldest_first: bool = False,
362
bulk: bool = True
363
) -> List[Message]:
364
"""
365
Purge messages from the channel.
366
367
Parameters:
368
- limit: int - Maximum messages to delete
369
- check: Callable - Function to check if a message should be deleted
370
- before: Snowflake - Delete messages before this message/time
371
- after: Snowflake - Delete messages after this message/time
372
- around: Snowflake - Delete messages around this message/time
373
- oldest_first: bool - Whether to delete oldest messages first
374
- bulk: bool - Whether to use bulk delete
375
"""
376
377
async def create_thread(
378
self,
379
*,
380
name: str,
381
message: Message = None,
382
auto_archive_duration: int = None,
383
type: ChannelType = None,
384
slowmode_delay: int = None,
385
**kwargs
386
) -> Thread:
387
"""
388
Create a thread in this channel.
389
390
Parameters:
391
- name: str - Thread name
392
- message: Message - Message to create thread from
393
- auto_archive_duration: int - Minutes before auto-archiving
394
- type: ChannelType - Thread type
395
- slowmode_delay: int - Slowmode delay in seconds
396
"""
397
398
async def edit(
399
self,
400
*,
401
name: str = None,
402
topic: str = None,
403
position: int = None,
404
nsfw: bool = None,
405
sync_permissions: bool = None,
406
category: CategoryChannel = None,
407
slowmode_delay: int = None,
408
type: ChannelType = None,
409
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = None,
410
**kwargs
411
) -> TextChannel:
412
"""Edit the channel."""
413
414
async def delete(self, *, reason: str = None) -> None:
415
"""Delete the channel."""
416
417
class VoiceChannel:
418
"""
419
Represents a Discord voice channel.
420
"""
421
422
@property
423
def id(self) -> int: ...
424
@property
425
def name(self) -> str: ...
426
@property
427
def guild(self) -> Guild: ...
428
@property
429
def bitrate(self) -> int:
430
"""The channel's bitrate."""
431
432
@property
433
def user_limit(self) -> int:
434
"""The channel's user limit."""
435
436
@property
437
def members(self) -> List[Member]:
438
"""Members currently in the voice channel."""
439
440
async def connect(
441
self,
442
*,
443
timeout: float = 60.0,
444
reconnect: bool = True,
445
cls: Callable = None
446
) -> VoiceClient:
447
"""Connect to the voice channel."""
448
449
async def edit(
450
self,
451
*,
452
name: str = None,
453
bitrate: int = None,
454
user_limit: int = None,
455
position: int = None,
456
sync_permissions: bool = None,
457
category: CategoryChannel = None,
458
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = None,
459
**kwargs
460
) -> VoiceChannel:
461
"""Edit the voice channel."""
462
463
class StageChannel:
464
"""
465
Represents a Discord stage channel for presentations.
466
"""
467
468
@property
469
def id(self) -> int: ...
470
@property
471
def name(self) -> str: ...
472
@property
473
def guild(self) -> Guild: ...
474
@property
475
def topic(self) -> Optional[str]: ...
476
@property
477
def bitrate(self) -> int: ...
478
@property
479
def user_limit(self) -> int: ...
480
@property
481
def instance(self) -> Optional[StageInstance]: ...
482
483
async def create_instance(
484
self,
485
*,
486
topic: str,
487
privacy_level: StagePrivacyLevel = StagePrivacyLevel.guild_only,
488
send_start_notification: bool = False,
489
**kwargs
490
) -> StageInstance:
491
"""Create a stage instance."""
492
493
class ForumChannel:
494
"""
495
Represents a Discord forum channel.
496
"""
497
498
@property
499
def id(self) -> int: ...
500
@property
501
def name(self) -> str: ...
502
@property
503
def guild(self) -> Guild: ...
504
@property
505
def topic(self) -> Optional[str]: ...
506
@property
507
def available_tags(self) -> List[ForumTag]: ...
508
@property
509
def default_reaction_emoji(self) -> Optional[Union[Emoji, PartialEmoji, str]]: ...
510
@property
511
def threads(self) -> List[Thread]: ...
512
513
async def create_thread(
514
self,
515
*,
516
name: str,
517
content: str = None,
518
embed: Embed = None,
519
embeds: List[Embed] = None,
520
file: File = None,
521
files: List[File] = None,
522
view: View = None,
523
applied_tags: List[ForumTag] = None,
524
slowmode_delay: int = None,
525
auto_archive_duration: int = None,
526
**kwargs
527
) -> Thread:
528
"""Create a forum post (thread)."""
529
530
class CategoryChannel:
531
"""
532
Represents a Discord category channel.
533
"""
534
535
@property
536
def id(self) -> int: ...
537
@property
538
def name(self) -> str: ...
539
@property
540
def guild(self) -> Guild: ...
541
@property
542
def channels(self) -> List[GuildChannel]: ...
543
@property
544
def text_channels(self) -> List[TextChannel]: ...
545
@property
546
def voice_channels(self) -> List[VoiceChannel]: ...
547
548
class DMChannel:
549
"""
550
Represents a Discord direct message channel.
551
"""
552
553
@property
554
def id(self) -> int: ...
555
@property
556
def recipient(self) -> User: ...
557
558
async def send(
559
self,
560
content: str = None,
561
*,
562
tts: bool = False,
563
embed: Embed = None,
564
embeds: List[Embed] = None,
565
file: File = None,
566
files: List[File] = None,
567
view: View = None,
568
**kwargs
569
) -> Message:
570
"""Send a message to the DM channel."""
571
572
class GroupChannel:
573
"""
574
Represents a Discord group direct message channel.
575
"""
576
577
@property
578
def id(self) -> int: ...
579
@property
580
def name(self) -> Optional[str]: ...
581
@property
582
def recipients(self) -> List[User]: ...
583
@property
584
def owner(self) -> Optional[User]: ...
585
```
586
587
### Messages and Communication
588
589
Messages represent content sent in Discord channels, including text, embeds, attachments, and interactive components.
590
591
```python { .api }
592
class Message:
593
"""
594
Represents a Discord message.
595
"""
596
597
@property
598
def id(self) -> int:
599
"""The message's ID."""
600
601
@property
602
def content(self) -> str:
603
"""The message content."""
604
605
@property
606
def author(self) -> Union[User, Member]:
607
"""The message author."""
608
609
@property
610
def channel(self) -> Union[TextChannel, DMChannel, GroupChannel, Thread]:
611
"""The channel where the message was sent."""
612
613
@property
614
def guild(self) -> Optional[Guild]:
615
"""The guild where the message was sent."""
616
617
@property
618
def created_at(self) -> datetime:
619
"""When the message was created."""
620
621
@property
622
def edited_at(self) -> Optional[datetime]:
623
"""When the message was last edited."""
624
625
@property
626
def embeds(self) -> List[Embed]:
627
"""A list of embeds in the message."""
628
629
@property
630
def attachments(self) -> List[Attachment]:
631
"""A list of file attachments."""
632
633
@property
634
def reactions(self) -> List[Reaction]:
635
"""A list of reactions on the message."""
636
637
@property
638
def mentions(self) -> List[Union[User, Member]]:
639
"""Users mentioned in the message."""
640
641
@property
642
def channel_mentions(self) -> List[GuildChannel]:
643
"""Channels mentioned in the message."""
644
645
@property
646
def role_mentions(self) -> List[Role]:
647
"""Roles mentioned in the message."""
648
649
@property
650
def mention_everyone(self) -> bool:
651
"""Whether the message mentions everyone."""
652
653
@property
654
def pinned(self) -> bool:
655
"""Whether the message is pinned."""
656
657
@property
658
def tts(self) -> bool:
659
"""Whether the message uses text-to-speech."""
660
661
@property
662
def type(self) -> MessageType:
663
"""The message type."""
664
665
@property
666
def flags(self) -> MessageFlags:
667
"""The message flags."""
668
669
@property
670
def reference(self) -> Optional[MessageReference]:
671
"""The message being replied to."""
672
673
@property
674
def thread(self) -> Optional[Thread]:
675
"""The thread created from this message."""
676
677
@property
678
def components(self) -> List[Component]:
679
"""UI components attached to the message."""
680
681
@property
682
def stickers(self) -> List[StickerItem]:
683
"""Stickers in the message."""
684
685
async def reply(
686
self,
687
content: str = None,
688
*,
689
tts: bool = False,
690
embed: Embed = None,
691
embeds: List[Embed] = None,
692
file: File = None,
693
files: List[File] = None,
694
view: View = None,
695
allowed_mentions: AllowedMentions = None,
696
mention_author: bool = None,
697
**kwargs
698
) -> Message:
699
"""Reply to the message."""
700
701
async def edit(
702
self,
703
*,
704
content: str = None,
705
embed: Embed = None,
706
embeds: List[Embed] = None,
707
attachments: List[Attachment] = None,
708
view: View = None,
709
allowed_mentions: AllowedMentions = None,
710
suppress: bool = None,
711
**kwargs
712
) -> Message:
713
"""Edit the message."""
714
715
async def delete(self, *, delay: float = None) -> None:
716
"""Delete the message."""
717
718
async def add_reaction(self, emoji: Union[Emoji, Reaction, PartialEmoji, str]) -> None:
719
"""Add a reaction to the message."""
720
721
async def remove_reaction(
722
self,
723
emoji: Union[Emoji, Reaction, PartialEmoji, str],
724
member: Union[Member, User]
725
) -> None:
726
"""Remove a reaction from the message."""
727
728
async def clear_reactions(self) -> None:
729
"""Clear all reactions from the message."""
730
731
async def pin(self, *, reason: str = None) -> None:
732
"""Pin the message."""
733
734
async def unpin(self, *, reason: str = None) -> None:
735
"""Unpin the message."""
736
737
async def create_thread(
738
self,
739
*,
740
name: str,
741
auto_archive_duration: int = None,
742
slowmode_delay: int = None,
743
**kwargs
744
) -> Thread:
745
"""Create a thread from this message."""
746
747
class PartialMessage:
748
"""
749
Represents a partial message object.
750
"""
751
752
@property
753
def id(self) -> int: ...
754
@property
755
def channel(self) -> Union[PartialMessageable, TextChannel, DMChannel, Thread]: ...
756
@property
757
def guild(self) -> Optional[Guild]: ...
758
759
async def fetch(self) -> Message:
760
"""Fetch the full message."""
761
762
async def edit(self, **kwargs) -> Message:
763
"""Edit the message."""
764
765
async def delete(self, *, delay: float = None) -> None:
766
"""Delete the message."""
767
768
class MessageReference:
769
"""
770
Represents a reference to another message.
771
"""
772
773
@property
774
def message_id(self) -> Optional[int]: ...
775
@property
776
def channel_id(self) -> int: ...
777
@property
778
def guild_id(self) -> Optional[int]: ...
779
@property
780
def resolved(self) -> Optional[Message]: ...
781
782
class Attachment:
783
"""
784
Represents a file attachment to a message.
785
"""
786
787
@property
788
def id(self) -> int: ...
789
@property
790
def filename(self) -> str: ...
791
@property
792
def description(self) -> Optional[str]: ...
793
@property
794
def content_type(self) -> Optional[str]: ...
795
@property
796
def size(self) -> int: ...
797
@property
798
def url(self) -> str: ...
799
@property
800
def proxy_url(self) -> str: ...
801
@property
802
def height(self) -> Optional[int]: ...
803
@property
804
def width(self) -> Optional[int]: ...
805
@property
806
def ephemeral(self) -> bool: ...
807
808
async def save(
809
self,
810
fp: Union[str, bytes, os.PathLike, io.BufferedIOBase],
811
*,
812
seek_begin: bool = True,
813
use_cached: bool = False
814
) -> int:
815
"""Save the attachment to a file."""
816
817
async def read(self, *, use_cached: bool = False) -> bytes:
818
"""Read the attachment data."""
819
820
async def to_file(
821
self,
822
*,
823
filename: str = None,
824
description: str = None,
825
use_cached: bool = False,
826
spoiler: bool = False
827
) -> File:
828
"""Convert to a File object."""
829
830
class Reaction:
831
"""
832
Represents a message reaction.
833
"""
834
835
@property
836
def emoji(self) -> Union[Emoji, PartialEmoji, str]: ...
837
@property
838
def count(self) -> int: ...
839
@property
840
def me(self) -> bool: ...
841
@property
842
def message(self) -> Message: ...
843
844
def users(self, *, limit: int = None, after: Snowflake = None) -> ReactionIterator:
845
"""Get users who reacted with this emoji."""
846
847
async def remove(self, user: Union[Member, User]) -> None:
848
"""Remove the reaction from a user."""
849
850
async def clear(self) -> None:
851
"""Clear this reaction from the message."""
852
```
853
854
### Users and Members
855
856
Users represent Discord accounts, while Members represent users within the context of a specific guild.
857
858
```python { .api }
859
class User:
860
"""
861
Represents a Discord user.
862
"""
863
864
@property
865
def id(self) -> int:
866
"""The user's ID."""
867
868
@property
869
def name(self) -> str:
870
"""The user's username."""
871
872
@property
873
def discriminator(self) -> str:
874
"""The user's discriminator."""
875
876
@property
877
def global_name(self) -> Optional[str]:
878
"""The user's global display name."""
879
880
@property
881
def display_name(self) -> str:
882
"""The user's display name."""
883
884
@property
885
def avatar(self) -> Optional[Asset]:
886
"""The user's avatar."""
887
888
@property
889
def banner(self) -> Optional[Asset]:
890
"""The user's banner."""
891
892
@property
893
def accent_color(self) -> Optional[Colour]:
894
"""The user's accent color."""
895
896
@property
897
def bot(self) -> bool:
898
"""Whether the user is a bot."""
899
900
@property
901
def system(self) -> bool:
902
"""Whether the user is a Discord system user."""
903
904
@property
905
def verified(self) -> bool:
906
"""Whether the user has a verified email."""
907
908
@property
909
def mfa_enabled(self) -> bool:
910
"""Whether the user has MFA enabled."""
911
912
@property
913
def public_flags(self) -> PublicUserFlags:
914
"""The user's public flags."""
915
916
@property
917
def created_at(self) -> datetime:
918
"""When the user account was created."""
919
920
async def send(
921
self,
922
content: str = None,
923
*,
924
tts: bool = False,
925
embed: Embed = None,
926
embeds: List[Embed] = None,
927
file: File = None,
928
files: List[File] = None,
929
view: View = None,
930
**kwargs
931
) -> Message:
932
"""Send a direct message to the user."""
933
934
async def create_dm(self) -> DMChannel:
935
"""Create a DM channel with the user."""
936
937
class Member(User):
938
"""
939
Represents a Discord guild member.
940
"""
941
942
@property
943
def guild(self) -> Guild:
944
"""The guild this member belongs to."""
945
946
@property
947
def nick(self) -> Optional[str]:
948
"""The member's nickname."""
949
950
@property
951
def display_name(self) -> str:
952
"""The member's display name (nickname or username)."""
953
954
@property
955
def roles(self) -> List[Role]:
956
"""The member's roles."""
957
958
@property
959
def joined_at(self) -> Optional[datetime]:
960
"""When the member joined the guild."""
961
962
@property
963
def premium_since(self) -> Optional[datetime]:
964
"""When the member started boosting."""
965
966
@property
967
def pending(self) -> bool:
968
"""Whether the member is pending verification."""
969
970
@property
971
def timed_out_until(self) -> Optional[datetime]:
972
"""When the member's timeout expires."""
973
974
@property
975
def voice(self) -> Optional[VoiceState]:
976
"""The member's voice state."""
977
978
@property
979
def activities(self) -> List[BaseActivity]:
980
"""The member's activities."""
981
982
@property
983
def status(self) -> Status:
984
"""The member's status."""
985
986
@property
987
def colour(self) -> Colour:
988
"""The member's color from their highest role."""
989
990
@property
991
def color(self) -> Colour:
992
"""Alias for colour."""
993
994
@property
995
def top_role(self) -> Role:
996
"""The member's highest role."""
997
998
@property
999
def guild_permissions(self) -> Permissions:
1000
"""The member's guild permissions."""
1001
1002
def permissions_in(self, channel: GuildChannel) -> Permissions:
1003
"""Get the member's permissions in a channel."""
1004
1005
async def add_roles(
1006
self,
1007
*roles: Role,
1008
reason: str = None,
1009
atomic: bool = True
1010
) -> None:
1011
"""Add roles to the member."""
1012
1013
async def remove_roles(
1014
self,
1015
*roles: Role,
1016
reason: str = None,
1017
atomic: bool = True
1018
) -> None:
1019
"""Remove roles from the member."""
1020
1021
async def edit(
1022
self,
1023
*,
1024
nick: str = None,
1025
mute: bool = None,
1026
deafen: bool = None,
1027
suppress: bool = None,
1028
roles: List[Role] = None,
1029
voice_channel: Optional[VoiceChannel] = None,
1030
timed_out_until: Optional[Union[float, datetime]] = None,
1031
**kwargs
1032
) -> Member:
1033
"""Edit the member."""
1034
1035
async def timeout(
1036
self,
1037
until: Union[float, datetime, timedelta],
1038
*,
1039
reason: str = None
1040
) -> Member:
1041
"""Timeout the member."""
1042
1043
async def remove_timeout(self, *, reason: str = None) -> Member:
1044
"""Remove the member's timeout."""
1045
1046
async def kick(self, *, reason: str = None) -> None:
1047
"""Kick the member from the guild."""
1048
1049
async def ban(
1050
self,
1051
*,
1052
reason: str = None,
1053
delete_message_days: int = None,
1054
delete_message_seconds: int = None
1055
) -> None:
1056
"""Ban the member from the guild."""
1057
1058
async def move_to(
1059
self,
1060
channel: Optional[VoiceChannel],
1061
*,
1062
reason: str = None
1063
) -> None:
1064
"""Move the member to a voice channel."""
1065
1066
class VoiceState:
1067
"""
1068
Represents a member's voice connection state.
1069
"""
1070
1071
@property
1072
def session_id(self) -> str: ...
1073
@property
1074
def channel(self) -> Optional[Union[VoiceChannel, StageChannel]]: ...
1075
@property
1076
def user_id(self) -> int: ...
1077
@property
1078
def member(self) -> Optional[Member]: ...
1079
@property
1080
def deaf(self) -> bool: ...
1081
@property
1082
def mute(self) -> bool: ...
1083
@property
1084
def self_deaf(self) -> bool: ...
1085
@property
1086
def self_mute(self) -> bool: ...
1087
@property
1088
def self_stream(self) -> bool: ...
1089
@property
1090
def self_video(self) -> bool: ...
1091
@property
1092
def suppress(self) -> bool: ...
1093
@property
1094
def requested_to_speak_at(self) -> Optional[datetime]: ...
1095
```
1096
1097
### Roles and Permissions
1098
1099
Roles define permissions and organizational structure within guilds.
1100
1101
```python { .api }
1102
class Role:
1103
"""
1104
Represents a Discord role.
1105
"""
1106
1107
@property
1108
def id(self) -> int:
1109
"""The role's ID."""
1110
1111
@property
1112
def name(self) -> str:
1113
"""The role's name."""
1114
1115
@property
1116
def guild(self) -> Guild:
1117
"""The guild this role belongs to."""
1118
1119
@property
1120
def color(self) -> Colour:
1121
"""The role's color."""
1122
1123
@property
1124
def colour(self) -> Colour:
1125
"""Alias for color."""
1126
1127
@property
1128
def hoist(self) -> bool:
1129
"""Whether the role is hoisted."""
1130
1131
@property
1132
def position(self) -> int:
1133
"""The role's position."""
1134
1135
@property
1136
def managed(self) -> bool:
1137
"""Whether the role is managed by an integration."""
1138
1139
@property
1140
def mentionable(self) -> bool:
1141
"""Whether the role is mentionable."""
1142
1143
@property
1144
def permissions(self) -> Permissions:
1145
"""The role's permissions."""
1146
1147
@property
1148
def tags(self) -> Optional[RoleTags]:
1149
"""The role's tags."""
1150
1151
@property
1152
def members(self) -> List[Member]:
1153
"""Members with this role."""
1154
1155
@property
1156
def created_at(self) -> datetime:
1157
"""When the role was created."""
1158
1159
@property
1160
def mention(self) -> str:
1161
"""The role's mention string."""
1162
1163
async def edit(
1164
self,
1165
*,
1166
name: str = None,
1167
permissions: Permissions = None,
1168
color: Union[Colour, int] = None,
1169
colour: Union[Colour, int] = None,
1170
hoist: bool = None,
1171
mentionable: bool = None,
1172
position: int = None,
1173
**kwargs
1174
) -> Role:
1175
"""Edit the role."""
1176
1177
async def delete(self, *, reason: str = None) -> None:
1178
"""Delete the role."""
1179
1180
class RoleTags:
1181
"""
1182
Represents role tags that give information about a role.
1183
"""
1184
1185
@property
1186
def bot_id(self) -> Optional[int]: ...
1187
@property
1188
def integration_id(self) -> Optional[int]: ...
1189
@property
1190
def premium_subscriber(self) -> bool: ...
1191
@property
1192
def available_for_purchase(self) -> bool: ...
1193
@property
1194
def guild_connections(self) -> bool: ...
1195
1196
class Permissions:
1197
"""
1198
Represents Discord permissions.
1199
"""
1200
1201
def __init__(self, permissions: int = 0, **kwargs) -> None: ...
1202
1203
@classmethod
1204
def none(cls) -> Permissions: ...
1205
@classmethod
1206
def all(cls) -> Permissions: ...
1207
@classmethod
1208
def all_channel(cls) -> Permissions: ...
1209
@classmethod
1210
def general(cls) -> Permissions: ...
1211
@classmethod
1212
def text(cls) -> Permissions: ...
1213
@classmethod
1214
def voice(cls) -> Permissions: ...
1215
@classmethod
1216
def stage(cls) -> Permissions: ...
1217
@classmethod
1218
def stage_moderator(cls) -> Permissions: ...
1219
@classmethod
1220
def elevated(cls) -> Permissions: ...
1221
@classmethod
1222
def advanced(cls) -> Permissions: ...
1223
1224
@property
1225
def value(self) -> int: ...
1226
1227
# Permission flags
1228
@property
1229
def create_instant_invite(self) -> bool: ...
1230
@property
1231
def kick_members(self) -> bool: ...
1232
@property
1233
def ban_members(self) -> bool: ...
1234
@property
1235
def administrator(self) -> bool: ...
1236
@property
1237
def manage_channels(self) -> bool: ...
1238
@property
1239
def manage_guild(self) -> bool: ...
1240
@property
1241
def add_reactions(self) -> bool: ...
1242
@property
1243
def view_audit_log(self) -> bool: ...
1244
@property
1245
def priority_speaker(self) -> bool: ...
1246
@property
1247
def stream(self) -> bool: ...
1248
@property
1249
def read_messages(self) -> bool: ...
1250
@property
1251
def view_channel(self) -> bool: ...
1252
@property
1253
def send_messages(self) -> bool: ...
1254
@property
1255
def send_tts_messages(self) -> bool: ...
1256
@property
1257
def manage_messages(self) -> bool: ...
1258
@property
1259
def embed_links(self) -> bool: ...
1260
@property
1261
def attach_files(self) -> bool: ...
1262
@property
1263
def read_message_history(self) -> bool: ...
1264
@property
1265
def mention_everyone(self) -> bool: ...
1266
@property
1267
def external_emojis(self) -> bool: ...
1268
@property
1269
def use_external_emojis(self) -> bool: ...
1270
@property
1271
def view_guild_insights(self) -> bool: ...
1272
@property
1273
def connect(self) -> bool: ...
1274
@property
1275
def speak(self) -> bool: ...
1276
@property
1277
def mute_members(self) -> bool: ...
1278
@property
1279
def deafen_members(self) -> bool: ...
1280
@property
1281
def move_members(self) -> bool: ...
1282
@property
1283
def use_voice_activation(self) -> bool: ...
1284
@property
1285
def change_nickname(self) -> bool: ...
1286
@property
1287
def manage_nicknames(self) -> bool: ...
1288
@property
1289
def manage_roles(self) -> bool: ...
1290
@property
1291
def manage_permissions(self) -> bool: ...
1292
@property
1293
def manage_webhooks(self) -> bool: ...
1294
@property
1295
def manage_emojis(self) -> bool: ...
1296
@property
1297
def manage_emojis_and_stickers(self) -> bool: ...
1298
@property
1299
def use_slash_commands(self) -> bool: ...
1300
@property
1301
def use_application_commands(self) -> bool: ...
1302
@property
1303
def request_to_speak(self) -> bool: ...
1304
@property
1305
def manage_events(self) -> bool: ...
1306
@property
1307
def manage_threads(self) -> bool: ...
1308
@property
1309
def create_public_threads(self) -> bool: ...
1310
@property
1311
def create_private_threads(self) -> bool: ...
1312
@property
1313
def external_stickers(self) -> bool: ...
1314
@property
1315
def use_external_stickers(self) -> bool: ...
1316
@property
1317
def send_messages_in_threads(self) -> bool: ...
1318
@property
1319
def use_embedded_activities(self) -> bool: ...
1320
@property
1321
def moderate_members(self) -> bool: ...
1322
1323
class PermissionOverwrite:
1324
"""
1325
Represents a channel permission overwrite.
1326
"""
1327
1328
def __init__(self, *, allow: Permissions = None, deny: Permissions = None) -> None: ...
1329
1330
@property
1331
def allow(self) -> Permissions: ...
1332
@property
1333
def deny(self) -> Permissions: ...
1334
@property
1335
def pair(self) -> Tuple[Permissions, Permissions]: ...
1336
1337
@classmethod
1338
def from_pair(cls, allow: Permissions, deny: Permissions) -> PermissionOverwrite: ...
1339
```
1340
1341
### Threads
1342
1343
Threads provide focused discussion spaces within channels.
1344
1345
```python { .api }
1346
class Thread:
1347
"""
1348
Represents a Discord thread.
1349
"""
1350
1351
@property
1352
def id(self) -> int: ...
1353
@property
1354
def name(self) -> str: ...
1355
@property
1356
def guild(self) -> Guild: ...
1357
@property
1358
def parent(self) -> Union[TextChannel, ForumChannel]: ...
1359
@property
1360
def owner_id(self) -> int: ...
1361
@property
1362
def owner(self) -> Optional[Member]: ...
1363
@property
1364
def last_message_id(self) -> Optional[int]: ...
1365
@property
1366
def slowmode_delay(self) -> int: ...
1367
@property
1368
def message_count(self) -> int: ...
1369
@property
1370
def member_count(self) -> int: ...
1371
@property
1372
def archived(self) -> bool: ...
1373
@property
1374
def locked(self) -> bool: ...
1375
@property
1376
def invitable(self) -> bool: ...
1377
@property
1378
def archive_timestamp(self) -> datetime: ...
1379
@property
1380
def auto_archive_duration(self) -> int: ...
1381
@property
1382
def applied_tags(self) -> List[ForumTag]: ...
1383
1384
async def send(
1385
self,
1386
content: str = None,
1387
*,
1388
tts: bool = False,
1389
embed: Embed = None,
1390
embeds: List[Embed] = None,
1391
file: File = None,
1392
files: List[File] = None,
1393
view: View = None,
1394
**kwargs
1395
) -> Message:
1396
"""Send a message to the thread."""
1397
1398
async def join(self) -> None:
1399
"""Join the thread."""
1400
1401
async def leave(self) -> None:
1402
"""Leave the thread."""
1403
1404
async def add_user(self, user: Union[Member, User]) -> None:
1405
"""Add a user to the thread."""
1406
1407
async def remove_user(self, user: Union[Member, User]) -> None:
1408
"""Remove a user from the thread."""
1409
1410
async def edit(
1411
self,
1412
*,
1413
name: str = None,
1414
archived: bool = None,
1415
locked: bool = None,
1416
invitable: bool = None,
1417
slowmode_delay: int = None,
1418
auto_archive_duration: int = None,
1419
applied_tags: List[ForumTag] = None,
1420
**kwargs
1421
) -> Thread:
1422
"""Edit the thread."""
1423
1424
async def delete(self) -> None:
1425
"""Delete the thread."""
1426
1427
class ThreadMember:
1428
"""
1429
Represents a member of a thread.
1430
"""
1431
1432
@property
1433
def id(self) -> int: ...
1434
@property
1435
def user_id(self) -> int: ...
1436
@property
1437
def thread(self) -> Thread: ...
1438
@property
1439
def joined_at(self) -> datetime: ...
1440
```
1441
1442
### Webhooks and External Integrations
1443
1444
Webhook support for external integrations and message posting.
1445
1446
```python { .api }
1447
class Webhook:
1448
"""
1449
Represents a Discord webhook for external integrations.
1450
"""
1451
1452
@property
1453
def id(self) -> int: ...
1454
@property
1455
def name(self) -> Optional[str]: ...
1456
@property
1457
def avatar(self) -> Optional[str]: ...
1458
@property
1459
def channel_id(self) -> Optional[int]: ...
1460
@property
1461
def guild_id(self) -> Optional[int]: ...
1462
@property
1463
def user(self) -> Optional[User]: ...
1464
@property
1465
def token(self) -> Optional[str]: ...
1466
@property
1467
def type(self) -> WebhookType: ...
1468
@property
1469
def source_guild(self) -> Optional[PartialWebhookGuild]: ...
1470
@property
1471
def source_channel(self) -> Optional[PartialWebhookChannel]: ...
1472
1473
async def send(
1474
self,
1475
content: str = None,
1476
*,
1477
username: str = None,
1478
avatar_url: str = None,
1479
tts: bool = False,
1480
embed: Embed = None,
1481
embeds: List[Embed] = None,
1482
file: File = None,
1483
files: List[File] = None,
1484
view: View = None,
1485
allowed_mentions: AllowedMentions = None,
1486
thread: Snowflake = None,
1487
wait: bool = False,
1488
**kwargs
1489
) -> Optional[WebhookMessage]:
1490
"""Send a message via webhook."""
1491
1492
async def edit_message(
1493
self,
1494
message_id: int,
1495
*,
1496
content: str = None,
1497
embed: Embed = None,
1498
embeds: List[Embed] = None,
1499
view: View = None,
1500
allowed_mentions: AllowedMentions = None,
1501
**kwargs
1502
) -> WebhookMessage:
1503
"""Edit a webhook message."""
1504
1505
async def delete_message(self, message_id: int) -> None:
1506
"""Delete a webhook message."""
1507
1508
async def fetch_message(self, message_id: int) -> WebhookMessage:
1509
"""Fetch a webhook message."""
1510
1511
class WebhookMessage:
1512
"""
1513
Represents a message sent by a webhook.
1514
"""
1515
1516
@property
1517
def id(self) -> int: ...
1518
@property
1519
def content(self) -> str: ...
1520
@property
1521
def embeds(self) -> List[Embed]: ...
1522
@property
1523
def author(self) -> WebhookAuthor: ...
1524
1525
async def edit(self, **kwargs) -> WebhookMessage: ...
1526
async def delete(self, *, delay: float = None) -> None: ...
1527
1528
class SyncWebhook:
1529
"""Synchronous webhook client for non-async environments."""
1530
1531
def send(self, **kwargs) -> Optional[WebhookMessage]: ...
1532
def edit_message(self, message_id: int, **kwargs) -> WebhookMessage: ...
1533
def delete_message(self, message_id: int) -> None: ...
1534
```
1535
1536
### Invites and Templates
1537
1538
Discord invite links and server templates for server creation and sharing.
1539
1540
```python { .api }
1541
class Invite:
1542
"""
1543
Represents a Discord invite.
1544
"""
1545
1546
@property
1547
def code(self) -> str: ...
1548
@property
1549
def guild(self) -> Optional[Union[Guild, PartialInviteGuild]]: ...
1550
@property
1551
def channel(self) -> Optional[Union[GuildChannel, PartialInviteChannel]]: ...
1552
@property
1553
def inviter(self) -> Optional[User]: ...
1554
@property
1555
def uses(self) -> Optional[int]: ...
1556
@property
1557
def max_uses(self) -> Optional[int]: ...
1558
@property
1559
def max_age(self) -> Optional[int]: ...
1560
@property
1561
def temporary(self) -> Optional[bool]: ...
1562
@property
1563
def created_at(self) -> Optional[datetime]: ...
1564
@property
1565
def expires_at(self) -> Optional[datetime]: ...
1566
@property
1567
def url(self) -> str: ...
1568
1569
async def delete(self, *, reason: str = None) -> None:
1570
"""Delete the invite."""
1571
1572
class Template:
1573
"""
1574
Represents a Discord guild template.
1575
"""
1576
1577
@property
1578
def code(self) -> str: ...
1579
@property
1580
def name(self) -> str: ...
1581
@property
1582
def description(self) -> Optional[str]: ...
1583
@property
1584
def usage_count(self) -> int: ...
1585
@property
1586
def creator(self) -> User: ...
1587
@property
1588
def created_at(self) -> datetime: ...
1589
@property
1590
def updated_at(self) -> datetime: ...
1591
@property
1592
def source_guild(self) -> Guild: ...
1593
@property
1594
def url(self) -> str: ...
1595
1596
async def create_guild(self, name: str, icon: bytes = None) -> Guild:
1597
"""Create a guild from this template."""
1598
1599
async def sync(self) -> Template:
1600
"""Sync the template with the source guild."""
1601
1602
async def edit(
1603
self,
1604
*,
1605
name: str = None,
1606
description: str = None
1607
) -> Template:
1608
"""Edit the template."""
1609
1610
async def delete(self) -> None:
1611
"""Delete the template."""
1612
```
1613
1614
### Scheduled Events
1615
1616
Guild scheduled events for community organization.
1617
1618
```python { .api }
1619
class ScheduledEvent:
1620
"""
1621
Represents a Discord scheduled event.
1622
"""
1623
1624
@property
1625
def id(self) -> int: ...
1626
@property
1627
def guild_id(self) -> int: ...
1628
@property
1629
def guild(self) -> Optional[Guild]: ...
1630
@property
1631
def channel_id(self) -> Optional[int]: ...
1632
@property
1633
def channel(self) -> Optional[Union[VoiceChannel, StageChannel]]: ...
1634
@property
1635
def creator_id(self) -> Optional[int]: ...
1636
@property
1637
def creator(self) -> Optional[User]: ...
1638
@property
1639
def name(self) -> str: ...
1640
@property
1641
def description(self) -> Optional[str]: ...
1642
@property
1643
def start_time(self) -> datetime: ...
1644
@property
1645
def end_time(self) -> Optional[datetime]: ...
1646
@property
1647
def privacy_level(self) -> ScheduledEventPrivacyLevel: ...
1648
@property
1649
def status(self) -> ScheduledEventStatus: ...
1650
@property
1651
def location(self) -> Optional[ScheduledEventLocation]: ...
1652
@property
1653
def user_count(self) -> Optional[int]: ...
1654
@property
1655
def cover_image(self) -> Optional[Asset]: ...
1656
1657
async def edit(
1658
self,
1659
*,
1660
name: str = None,
1661
description: str = None,
1662
start_time: datetime = None,
1663
end_time: datetime = None,
1664
privacy_level: ScheduledEventPrivacyLevel = None,
1665
status: ScheduledEventStatus = None,
1666
location: str = None,
1667
cover_image: bytes = None,
1668
**kwargs
1669
) -> ScheduledEvent:
1670
"""Edit the scheduled event."""
1671
1672
async def delete(self) -> None:
1673
"""Delete the scheduled event."""
1674
1675
async def start(self) -> ScheduledEvent:
1676
"""Start the scheduled event."""
1677
1678
async def end(self) -> ScheduledEvent:
1679
"""End the scheduled event."""
1680
1681
async def cancel(self) -> ScheduledEvent:
1682
"""Cancel the scheduled event."""
1683
1684
def subscribers(self, *, limit: int = 100, before: Snowflake = None, after: Snowflake = None) -> ScheduledEventSubscribersIterator:
1685
"""Get subscribers to the event."""
1686
```
1687
1688
### Auto-Moderation
1689
1690
Auto-moderation rules and actions for content filtering.
1691
1692
```python { .api }
1693
class AutoModRule:
1694
"""
1695
Represents an auto-moderation rule.
1696
"""
1697
1698
@property
1699
def id(self) -> int: ...
1700
@property
1701
def guild_id(self) -> int: ...
1702
@property
1703
def guild(self) -> Guild: ...
1704
@property
1705
def name(self) -> str: ...
1706
@property
1707
def creator_id(self) -> int: ...
1708
@property
1709
def creator(self) -> Optional[Member]: ...
1710
@property
1711
def trigger(self) -> AutoModTrigger: ...
1712
@property
1713
def actions(self) -> List[AutoModAction]: ...
1714
@property
1715
def enabled(self) -> bool: ...
1716
@property
1717
def exempt_roles(self) -> List[Role]: ...
1718
@property
1719
def exempt_channels(self) -> List[GuildChannel]: ...
1720
1721
async def edit(
1722
self,
1723
*,
1724
name: str = None,
1725
trigger: AutoModTrigger = None,
1726
actions: List[AutoModAction] = None,
1727
enabled: bool = None,
1728
exempt_roles: List[Snowflake] = None,
1729
exempt_channels: List[Snowflake] = None,
1730
**kwargs
1731
) -> AutoModRule:
1732
"""Edit the auto-mod rule."""
1733
1734
async def delete(self) -> None:
1735
"""Delete the auto-mod rule."""
1736
1737
class AutoModAction:
1738
"""
1739
Represents an auto-moderation action.
1740
"""
1741
1742
@property
1743
def type(self) -> AutoModActionType: ...
1744
@property
1745
def metadata(self) -> Optional[AutoModActionMetadata]: ...
1746
```
1747
1748
### Application Information and Teams
1749
1750
Bot application information and developer team management.
1751
1752
```python { .api }
1753
class AppInfo:
1754
"""
1755
Represents Discord application information.
1756
"""
1757
1758
@property
1759
def id(self) -> int: ...
1760
@property
1761
def name(self) -> str: ...
1762
@property
1763
def icon(self) -> Optional[Asset]: ...
1764
@property
1765
def description(self) -> str: ...
1766
@property
1767
def rpc_origins(self) -> List[str]: ...
1768
@property
1769
def bot_public(self) -> bool: ...
1770
@property
1771
def bot_require_code_grant(self) -> bool: ...
1772
@property
1773
def owner(self) -> Optional[User]: ...
1774
@property
1775
def team(self) -> Optional[Team]: ...
1776
@property
1777
def verify_key(self) -> str: ...
1778
@property
1779
def guild_id(self) -> Optional[int]: ...
1780
@property
1781
def guild(self) -> Optional[Guild]: ...
1782
@property
1783
def primary_sku_id(self) -> Optional[int]: ...
1784
@property
1785
def slug(self) -> Optional[str]: ...
1786
@property
1787
def cover_image(self) -> Optional[Asset]: ...
1788
@property
1789
def flags(self) -> ApplicationFlags: ...
1790
1791
class Team:
1792
"""
1793
Represents a Discord developer team.
1794
"""
1795
1796
@property
1797
def id(self) -> int: ...
1798
@property
1799
def name(self) -> str: ...
1800
@property
1801
def icon(self) -> Optional[Asset]: ...
1802
@property
1803
def owner_id(self) -> int: ...
1804
@property
1805
def owner(self) -> Optional[TeamMember]: ...
1806
@property
1807
def members(self) -> List[TeamMember]: ...
1808
1809
class TeamMember:
1810
"""
1811
Represents a member of a developer team.
1812
"""
1813
1814
@property
1815
def membership_state(self) -> TeamMembershipState: ...
1816
@property
1817
def permissions(self) -> List[str]: ...
1818
@property
1819
def team_id(self) -> int: ...
1820
@property
1821
def user(self) -> User: ...
1822
```
1823
1824
### Monetization and SKUs
1825
1826
Discord's monetization features for premium applications.
1827
1828
```python { .api }
1829
class SKU:
1830
"""
1831
Represents a Stock Keeping Unit (purchasable product).
1832
"""
1833
1834
@property
1835
def id(self) -> int: ...
1836
@property
1837
def type(self) -> SKUType: ...
1838
@property
1839
def application_id(self) -> int: ...
1840
@property
1841
def name(self) -> str: ...
1842
@property
1843
def slug(self) -> str: ...
1844
@property
1845
def flags(self) -> SKUFlags: ...
1846
1847
class Entitlement:
1848
"""
1849
Represents a user's entitlement to a product.
1850
"""
1851
1852
@property
1853
def id(self) -> int: ...
1854
@property
1855
def sku_id(self) -> int: ...
1856
@property
1857
def application_id(self) -> int: ...
1858
@property
1859
def user_id(self) -> Optional[int]: ...
1860
@property
1861
def user(self) -> Optional[User]: ...
1862
@property
1863
def guild_id(self) -> Optional[int]: ...
1864
@property
1865
def guild(self) -> Optional[Guild]: ...
1866
@property
1867
def type(self) -> EntitlementType: ...
1868
@property
1869
def deleted(self) -> bool: ...
1870
@property
1871
def starts_at(self) -> Optional[datetime]: ...
1872
@property
1873
def ends_at(self) -> Optional[datetime]: ...
1874
```
1875
1876
These Discord objects form the core data model for interacting with Discord's API, providing comprehensive access to all aspects of Discord servers, channels, messages, users, and their relationships.