Skip to content

Commit 0eef1d3

Browse files
committed
feat(permissions): Add USE_SOUNDBOARD, CREATE_EXPRESSIONS and CREATE_EVENTS permission
Signed-off-by: Mathieu Corsham <[email protected]>
1 parent db085c5 commit 0eef1d3

File tree

1 file changed

+60
-15
lines changed

1 file changed

+60
-15
lines changed

discord/permissions.py

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def all(cls):
150150
"""A factory method that creates a :class:`Permissions` with all
151151
permissions set to ``True``.
152152
"""
153-
return cls(0b10011110111111111111111111111111111111111)
153+
return cls(0b1111111111111111111111111111111111111111111)
154154

155155
@classmethod
156156
def all_channel(cls):
@@ -197,7 +197,7 @@ def membership(cls):
197197
198198
.. versionadded:: 1.7
199199
"""
200-
return cls(0b00001100000000000000000000000111)
200+
return cls(0b10000000000001100000000000000000000000111)
201201

202202
@classmethod
203203
def text(cls):
@@ -208,13 +208,13 @@ def text(cls):
208208
Permission :attr:`read_messages` is no longer part of the text permissions.
209209
Added :attr:`use_slash_commands` permission.
210210
"""
211-
return cls(0b10000000000001111111100001000000)
211+
return cls(0b11110010000000000001111111100001000000)
212212

213213
@classmethod
214214
def voice(cls):
215215
"""A factory method that creates a :class:`Permissions` with all
216216
"Voice" permissions from the official Discord UI set to ``True``."""
217-
return cls(0b00000011111100000000001100000000)
217+
return cls(0b1000000000000000011111100000000001100000000)
218218

219219
@classmethod
220220
def stage(cls):
@@ -463,22 +463,52 @@ def manage_permissions(self):
463463
def manage_webhooks(self):
464464
""":class:`bool`: Returns ``True`` if a user can create, edit, or delete webhooks."""
465465
return 1 << 29
466-
466+
467467
@flag_value
468+
def manage_expressions(self):
469+
""":class:`bool`: Returns ``True`` if a user can create, edit, or delete emojis, stickers and sounds."""
470+
return 1 << 30
471+
472+
@make_permission_alias('manage_expressions')
468473
def manage_emojis(self):
469-
""":class:`bool`: Returns ``True`` if a user can create, edit, or delete emojis and stickers."""
474+
""":class:`bool`: An aliase for :attr:`manage_expressions`"""
470475
return 1 << 30
471-
472-
@make_permission_alias('manage_emojis')
476+
477+
@make_permission_alias('manage_expressions')
478+
def manage_stickers(self):
479+
""":class:`bool`: An aliase for :attr:`manage_expressions`"""
480+
return 1 << 30
481+
482+
@make_permission_alias('manage_expressions')
473483
def manage_emojis_and_stickers(self):
474-
""":class:`bool`: An aliase for :attr:`manage_emojis`"""
484+
""":class:`bool`: An aliase for :attr:`manage_expressions`"""
475485
return 1 << 30
476-
477-
@make_permission_alias('manage_emojis')
478-
def manage_stickers(self):
479-
""":class:`bool`: An aliase for :attr:`manage_emojis`"""
486+
487+
@make_permission_alias('manage_expressions')
488+
def manage_sounds(self):
489+
""":class:`bool`: An aliase for :attr:`manage_expressions`"""
480490
return 1 << 30
481-
491+
492+
@flag_value
493+
def create_expressions(self):
494+
""":class:`bool`: Returns ``True`` if a user can create emojis, stickers or `sounds <https://support.discord.com/hc/de/articles/12612888127767-Soundboard-FAQ>`_ in a server."""
495+
return 1 << 43
496+
497+
@make_permission_alias('create_expressions')
498+
def create_emojis(self):
499+
""":class:`bool`: An aliase for :attr:`create_expressions`"""
500+
return 1 << 43
501+
502+
@make_permission_alias('create_expressions')
503+
def create_stickers(self):
504+
""":class:`bool`: An aliase for :attr:`create_expressions`"""
505+
return 1 << 43
506+
507+
@make_permission_alias('create_expressions')
508+
def create_sounds(self):
509+
""":class:`bool`: An aliase for :attr:`create_expressions`"""
510+
return 1 << 43
511+
482512
@flag_value
483513
def use_slash_commands(self):
484514
""":class:`bool`: Returns ``True`` if a user can use slash commands and context-menu commands.
@@ -502,8 +532,13 @@ def request_to_speak(self):
502532

503533
@flag_value
504534
def manage_events(self):
505-
""":class:`bool`: Returns ``True`` if a user can manage Guild_Scheduled-Events."""
535+
""":class:`bool`: Returns ``True`` if a user can create and manage Guild-Scheduled-Events."""
506536
return 1 << 33
537+
538+
@flag_value
539+
def create_events(self):
540+
""":class:`bool`: Returns ``True`` if a user can create Guild-Scheduled-Events."""
541+
return 1 << 44
507542

508543
@flag_value
509544
def manage_threads(self):
@@ -555,6 +590,16 @@ def moderate_members(self):
555590
def timeout_members(self):
556591
""":class:`bool`: An alias for :attr:`moderate_members`."""
557592
return 1 << 40
593+
594+
@flag_value
595+
def view_creator_monetization_analytics(self):
596+
""":class:`bool`: Returns ``True`` if a user can view analytics for monetization of their content."""
597+
return 1 << 41
598+
599+
@flag_value
600+
def use_soundboard(self):
601+
""":class:`bool`: Returns ``True`` if a user can use the soundboard in a voice channel."""
602+
return 1 << 42
558603

559604

560605
def augment_from_permissions(cls):

0 commit comments

Comments
 (0)