Skip to content

Commit e081b34

Browse files
authored
Merge pull request #271 from Aiko-IT-Systems/flags
Add missing flags
2 parents 4d8306c + f8fb5af commit e081b34

File tree

5 files changed

+148
-0
lines changed

5 files changed

+148
-0
lines changed

discord/enums.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ class ChannelType(Enum):
185185
public_thread = 11
186186
private_thread = 12
187187
stage_voice = 13
188+
directory = 14
189+
forum = 15
188190

189191
def __str__(self):
190192
return self.name
@@ -214,6 +216,7 @@ class MessageType(Enum):
214216
application_command = 20
215217
thread_starter_message = 21
216218
guild_invite_reminder = 22
219+
context_menu_command = 23
217220

218221

219222
class VoiceRegion(Enum):
@@ -285,6 +288,7 @@ class Status(Enum):
285288
dnd = 'dnd'
286289
do_not_disturb = 'dnd'
287290
invisible = 'invisible'
291+
streaming = 'streaming'
288292

289293
def __str__(self):
290294
return self.value
@@ -356,6 +360,9 @@ class AuditLogAction(Enum):
356360
sticker_create = 90
357361
sticker_update = 91
358362
sticker_delete = 92
363+
scheduled_event_create = 100
364+
scheduled_event_update = 101
365+
scheduled_event_delete = 102
359366
thread_create = 110
360367
thread_update = 111
361368
thread_delete = 112
@@ -406,6 +413,9 @@ def category(self) -> Optional[AuditLogActionCategory]:
406413
AuditLogAction.sticker_create: AuditLogActionCategory.create,
407414
AuditLogAction.sticker_update: AuditLogActionCategory.update,
408415
AuditLogAction.sticker_delete: AuditLogActionCategory.delete,
416+
AuditLogAction.scheduled_event_create: AuditLogActionCategory.create,
417+
AuditLogAction.scheduled_event_update: AuditLogActionCategory.update,
418+
AuditLogAction.scheduled_event_delete: AuditLogActionCategory.delete,
409419
AuditLogAction.thread_create: AuditLogActionCategory.create,
410420
AuditLogAction.thread_update: AuditLogActionCategory.update,
411421
AuditLogAction.thread_delete: AuditLogActionCategory.delete,
@@ -442,6 +452,8 @@ def target_type(self) -> Optional[str]:
442452
return 'stage_instance'
443453
elif v < 93:
444454
return 'sticker'
455+
elif v < 103:
456+
return 'scheduled_event'
445457
elif v < 113:
446458
return 'thread'
447459

@@ -458,12 +470,16 @@ class UserFlags(Enum):
458470
hypesquad_balance = 256
459471
early_supporter = 512
460472
team_user = 1024
473+
partner_or_verification_application = 2048
461474
system = 4096
462475
has_unread_urgent_messages = 8192
463476
bug_hunter_level_2 = 16384
477+
underage_deleted = 32768
464478
verified_bot = 65536
465479
verified_bot_developer = 131072
466480
discord_certified_moderator = 262144
481+
bot_http_interactions = 524288
482+
spammer = 1048576
467483

468484

469485
class ActivityType(Enum):
@@ -530,6 +546,7 @@ class InteractionType(Enum):
530546
ping = 1
531547
application_command = 2
532548
component = 3
549+
auto_complete = 4
533550

534551

535552
class InteractionResponseType(Enum):
@@ -540,6 +557,7 @@ class InteractionResponseType(Enum):
540557
deferred_channel_message = 5 # (with source)
541558
deferred_message_update = 6 # for components
542559
message_update = 7 # for components
560+
auto_complete_result = 8 # for autocomplete interactions
543561

544562

545563
class VideoQualityMode(Enum):

discord/flags.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,24 @@ def ephemeral(self):
296296
"""
297297
return 64
298298

299+
@flag_value
300+
def loading(self):
301+
""":class:`bool`: Returns ``True`` if the source message an deferred.
302+
303+
The user sees a 'thinking' state
304+
305+
.. versionadded:: 2.0
306+
"""
307+
return 128
308+
309+
@flag_value
310+
def failed_to_mention_some_roles_in_thread(self):
311+
""":class:`bool`: Returns ``True`` if some roles are failed to mention in a thread.
312+
313+
.. versionadded:: 2.0
314+
"""
315+
return 256
316+
299317

300318
@fill_with_flags()
301319
class PublicUserFlags(BaseFlags):
@@ -350,6 +368,16 @@ def bug_hunter(self):
350368
""":class:`bool`: Returns ``True`` if the user is a Bug Hunter"""
351369
return UserFlags.bug_hunter.value
352370

371+
@flag_value
372+
def mfa_sms(self):
373+
""":class:`bool`: Returns ``True`` if the user has SMS recovery for 2FA enabled"""
374+
return UserFlags.mfa_sms.value
375+
376+
@flag_value
377+
def premium_promo_dismissed(self):
378+
""":class:`bool`: Returns ``True`` if the user is marked as dismissed Nitro promotion"""
379+
return UserFlags.premium_promo_dismissed.value
380+
353381
@flag_value
354382
def hypesquad_bravery(self):
355383
""":class:`bool`: Returns ``True`` if the user is a HypeSquad Bravery member."""
@@ -375,6 +403,11 @@ def team_user(self):
375403
""":class:`bool`: Returns ``True`` if the user is a Team User."""
376404
return UserFlags.team_user.value
377405

406+
@flag_value
407+
def partner_or_verification_application(self):
408+
""":class:`bool`: Relates to partner/verification applications."""
409+
return UserFlags.partner_or_verification_application.value
410+
378411
@flag_value
379412
def system(self):
380413
""":class:`bool`: Returns ``True`` if the user is a system user (i.e. represents Discord officially)."""
@@ -385,6 +418,11 @@ def bug_hunter_level_2(self):
385418
""":class:`bool`: Returns ``True`` if the user is a Bug Hunter Level 2"""
386419
return UserFlags.bug_hunter_level_2.value
387420

421+
@flag_value
422+
def underage_deleted(self):
423+
""":class:`bool`: Returns ``True`` if the user has a pending deletion for being underage in DOB prompt"""
424+
return UserFlags.underage_deleted.value
425+
388426
@flag_value
389427
def verified_bot(self):
390428
""":class:`bool`: Returns ``True`` if the user is a Verified Bot."""
@@ -411,6 +449,22 @@ def discord_certified_moderator(self):
411449
"""
412450
return UserFlags.discord_certified_moderator.value
413451

452+
@flag_value
453+
def bot_http_interactions(self):
454+
""":class:`bool`: Returns ``True`` if is a bot http interaction.
455+
456+
.. versionadded:: 2.0
457+
"""
458+
return UserFlags.bot_http_interactions.value
459+
460+
@flag_value
461+
def spammer(self):
462+
""":class:`bool`: Returns ``True`` if the user is flagged as spammer.
463+
464+
.. versionadded:: 2.0
465+
"""
466+
return UserFlags.spammer.value
467+
414468
def all(self) -> List[UserFlags]:
415469
"""List[:class:`UserFlags`]: Returns all public flags the user has."""
416470
return [public_flag for public_flag in UserFlags if self._has_flag(public_flag.value)]

discord/guild.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,22 +199,34 @@ class Guild(Hashable):
199199
200200
They are currently as follows:
201201
202+
- ``ANIMATED_BANNER``: Guild can upload an animated banner.
202203
- ``ANIMATED_ICON``: Guild can upload an animated icon.
203204
- ``BANNER``: Guild can upload and use a banner. (i.e. :attr:`.banner`)
204205
- ``COMMERCE``: Guild can sell things using store channels.
205206
- ``COMMUNITY``: Guild is a community server.
206207
- ``DISCOVERABLE``: Guild shows up in Server Discovery.
207208
- ``FEATURABLE``: Guild is able to be featured in Server Discovery.
209+
- ``HAS_DIRECTORY_ENTRY``: Unknown.
210+
- ``HUB``: Hubs contain a directory channel that let you find school-related, student-run servers for your school or university.
208211
- ``INVITE_SPLASH``: Guild's invite page can have a special splash.
212+
- ``LINKED_TO_HUB``: 'Guild is linked to a hub.
213+
- ``MEMBER_PROFILES``: Unknown.
209214
- ``MEMBER_VERIFICATION_GATE_ENABLED``: Guild has Membership Screening enabled.
210215
- ``MONETIZATION_ENABLED``: Guild has enabled monetization.
211216
- ``MORE_EMOJI``: Guild has increased custom emoji slots.
212217
- ``MORE_STICKERS``: Guild has increased custom sticker slots.
213218
- ``NEWS``: Guild can create news channels.
219+
- ``NEW_THREAD_PERMISSIONS``: Guild has new thread permissions.
214220
- ``PARTNERED``: Guild is a partnered server.
221+
- ``PREMIUM_TIER_3_OVERRIDE``: Forces the server to server boosting level 3 (specifically created by Discord Staff Member "Jethro" for their personal server).
215222
- ``PREVIEW_ENABLED``: Guild can be viewed before being accepted via Membership Screening.
216223
- ``PRIVATE_THREADS``: Guild has access to create private threads.
224+
- ``ROLE_ICONS``: Guild can set an image or emoji as a role icon.
225+
- ``ROLE_SUBSCRIPTIONS_ENABLED``: Guild is able to view and manage role subscriptions.
217226
- ``SEVEN_DAY_THREAD_ARCHIVE``: Guild has access to the seven day archive time for threads.
227+
- ``TEXT_IN_VOICE_ENABLED``: Guild has a chat button inside voice channels that opens a dedicated text channel in a sidebar similar to thread view.
228+
- ``THREAD_DEFAULT_AUTO_ARCHIVE_DURATION``: Unknown, presumably used for testing changes to the thread default auto archive duration..
229+
- ``THREADS_ENABLED_TESTING``: Used by bot developers to test their bots with threads in guilds with 5 or less members and a bot. Also gives the premium thread features.
218230
- ``THREE_DAY_THREAD_ARCHIVE``: Guild has access to the three day archive time for threads.
219231
- ``TICKETED_EVENTS_ENABLED``: Guild has enabled ticketed events.
220232
- ``VANITY_URL``: Guild can have a vanity invite URL (e.g. discord.gg/discord-api).

discord/types/guild.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,34 @@ class _GuildOptional(TypedDict, total=False):
7676
NSFWLevel = Literal[0, 1, 2, 3]
7777
PremiumTier = Literal[0, 1, 2, 3]
7878
GuildFeature = Literal[
79+
'ANIMATED_BANNER',
7980
'ANIMATED_ICON',
8081
'BANNER',
8182
'COMMERCE',
8283
'COMMUNITY',
8384
'DISCOVERABLE',
8485
'FEATURABLE',
86+
'HAS_DIRECTORY_ENTRY',
87+
'HUB',
8588
'INVITE_SPLASH',
89+
'LINKED_TO_HUB',
90+
'MEMBER_PROFILES',
8691
'MEMBER_VERIFICATION_GATE_ENABLED',
8792
'MONETIZATION_ENABLED',
8893
'MORE_EMOJI',
8994
'MORE_STICKERS',
9095
'NEWS',
96+
'NEW_THREAD_PERMISSIONS',
9197
'PARTNERED',
98+
'PREMIUM_TIER_3_OVERRIDE',
9299
'PREVIEW_ENABLED',
93100
'PRIVATE_THREADS',
101+
'ROLE_ICONS',
102+
'ROLE_SUBSCRIPTIONS_ENABLED',
94103
'SEVEN_DAY_THREAD_ARCHIVE',
104+
'TEXT_IN_VOICE_ENABLED',
105+
'THREAD_DEFAULT_AUTO_ARCHIVE_DURATION',
106+
'THREADS_ENABLED_TESTING',
95107
'THREE_DAY_THREAD_ARCHIVE',
96108
'TICKETED_EVENTS_ENABLED',
97109
'VANITY_URL',

docs/api.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,26 @@ of :class:`enum.Enum`.
12511251

12521252
.. versionadded:: 2.0
12531253

1254+
.. attribute:: directory
1255+
1256+
A guild directory entry.
1257+
1258+
Used in hub guilds.
1259+
1260+
In Experiment.
1261+
1262+
.. versionadded:: 2.0
1263+
1264+
.. attribute:: forum
1265+
1266+
User can only write in threads.
1267+
1268+
Similar functionality to a forum.
1269+
1270+
In Experiment.
1271+
1272+
.. versionadded:: 2.0
1273+
12541274
.. class:: MessageType
12551275

12561276
Specifies the type of :class:`Message`. This is used to denote if a message
@@ -1370,6 +1390,11 @@ of :class:`enum.Enum`.
13701390
The system message denoting the message in the thread that is the one that started the
13711391
thread's conversation topic.
13721392

1393+
.. versionadded:: 2.0
1394+
.. attribute:: context_menu_command
1395+
1396+
The system message denoting that an context menu command was executed.
1397+
13731398
.. versionadded:: 2.0
13741399

13751400
.. class:: UserFlags
@@ -1472,6 +1497,9 @@ of :class:`enum.Enum`.
14721497
.. attribute:: component
14731498

14741499
Represents a component based interaction, i.e. using the Discord Bot UI Kit.
1500+
.. attribute:: auto_complete
1501+
1502+
Represents a autocomplete interaction for slash commands.
14751503

14761504
.. class:: InteractionResponseType
14771505

@@ -1505,6 +1533,9 @@ of :class:`enum.Enum`.
15051533
Responds to the interaction by editing the message.
15061534

15071535
See also :meth:`InteractionResponse.edit_message`
1536+
.. attribute:: auto_complete_result
1537+
1538+
Responds to autocomplete requests.
15081539

15091540
.. class:: ComponentType
15101541

@@ -1791,6 +1822,9 @@ of :class:`enum.Enum`.
17911822
The member is "invisible". In reality, this is only used in sending
17921823
a presence a la :meth:`Client.change_presence`. When you receive a
17931824
user's presence this will be :attr:`offline` instead.
1825+
.. attribute:: streaming
1826+
1827+
The member is streaming.
17941828

17951829

17961830
.. class:: AuditLogAction
@@ -2385,6 +2419,24 @@ of :class:`enum.Enum`.
23852419

23862420
.. versionadded:: 2.0
23872421

2422+
.. attribute:: scheduled_event_create
2423+
2424+
A scheduled event was created.
2425+
2426+
.. versionadded:: 2.0
2427+
2428+
.. attribute:: scheduled_event_update
2429+
2430+
A scheduled event was updated.
2431+
2432+
.. versionadded:: 2.0
2433+
2434+
.. attribute:: scheduled_event_delete
2435+
2436+
A scheduled event was deleted.
2437+
2438+
.. versionadded:: 2.0
2439+
23882440
.. attribute:: thread_create
23892441

23902442
A thread was created.

0 commit comments

Comments
 (0)