From 4fc423d290c7818d448a2adc2f37758bf62885f5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 10 Feb 2023 12:24:57 -0600 Subject: [PATCH] chore(pre-commit): pre-commit autoupdate (#1909) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(pre-commit): pre-commit autoupdate updates: - [github.com/PyCQA/autoflake: v2.0.0 → v2.0.1](https://github.com/PyCQA/autoflake/compare/v2.0.0...v2.0.1) - [github.com/psf/black: 22.12.0 → 23.1.0](https://github.com/psf/black/compare/22.12.0...23.1.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove stale comment The preview feature was moved to stable in v23, and the bug previously preventing us from using the new style was fixed in psf/black#3430 Signed-off-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com> * try preview flag for black Signed-off-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * style(pre-commit): disable black --preview flag --------- Signed-off-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com> --- .pre-commit-config.yaml | 5 +- discord/_version.py | 6 +- discord/abc.py | 8 ++- discord/application_role_connection.py | 2 +- discord/channel.py | 8 ++- discord/cog.py | 10 +-- discord/commands/core.py | 6 +- discord/enums.py | 4 +- discord/ext/commands/core.py | 16 +++-- discord/ext/pages/pagination.py | 22 ++++--- discord/gateway.py | 6 +- discord/guild.py | 8 ++- discord/http.py | 12 ++-- discord/iterators.py | 1 - discord/opus.py | 4 +- discord/partial_emoji.py | 5 +- discord/state.py | 84 +++++++++++++++++--------- discord/ui/select.py | 18 ++++-- discord/ui/view.py | 1 - discord/utils.py | 2 +- discord/webhook/async_.py | 12 ++-- discord/webhook/sync.py | 12 ++-- docs/conf.py | 1 + examples/basic_voice.py | 4 +- examples/cooldown.py | 1 + examples/create_private_emoji.py | 1 + examples/views/channel_select.py | 1 + examples/views/role_select.py | 1 + 28 files changed, 169 insertions(+), 92 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0c5042d4f1..50d52ea416 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - repo: https://github.com/PyCQA/autoflake - rev: v2.0.0 + rev: v2.0.1 hooks: - id: autoflake # args: @@ -27,10 +27,9 @@ repos: hooks: - id: isort - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black - # See https://github.com/psf/black/issues/2188#issuecomment-1289317647 for why we can't use the --preview flag. args: [--safe, --quiet] - repo: https://github.com/Pierre-Sassoulas/black-disable-checker rev: v1.1.3 diff --git a/discord/_version.py b/discord/_version.py index 70b66e8c95..53ee5883cf 100644 --- a/discord/_version.py +++ b/discord/_version.py @@ -47,8 +47,10 @@ # setuptools_scm is not installed __version__ = "0.0.0" warnings.warn( - "Package is not installed, and setuptools_scm is not installed. " - f"As a fallback, {__name__}.__version__ will be set to {__version__}", + ( + "Package is not installed, and setuptools_scm is not installed. " + f"As a fallback, {__name__}.__version__ will be set to {__version__}" + ), RuntimeWarning, stacklevel=2, ) diff --git a/discord/abc.py b/discord/abc.py index 131b92ce13..4ab10409c0 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -478,9 +478,11 @@ async def _edit( "allow": allow.value, "deny": deny.value, "id": target.id, - "type": _Overwrites.ROLE - if isinstance(target, Role) - else _Overwrites.MEMBER, + "type": ( + _Overwrites.ROLE + if isinstance(target, Role) + else _Overwrites.MEMBER + ), } perms.append(payload) diff --git a/discord/application_role_connection.py b/discord/application_role_connection.py index ac031c007c..dc4ef01d83 100644 --- a/discord/application_role_connection.py +++ b/discord/application_role_connection.py @@ -89,7 +89,7 @@ def __init__( def __repr__(self): return ( - f" str: - return f"" + return ( + "" + ) def __str__(self) -> str: return self.name diff --git a/discord/cog.py b/discord/cog.py index 232c4c0173..9e3d8733a4 100644 --- a/discord/cog.py +++ b/discord/cog.py @@ -232,8 +232,8 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta: # r.e type ignore, type-checker complains about overriding a ClassVar new_cls.__cog_commands__ = tuple(c._update_copy(cmd_attrs) if not hasattr(c, "add_to") else c for c in new_cls.__cog_commands__) # type: ignore - name_filter = ( - lambda c: "app" + name_filter = lambda c: ( + "app" if isinstance(c, ApplicationCommand) else ("bridge" if not hasattr(c, "add_to") else "ext") ) @@ -1019,8 +1019,10 @@ def load_extensions( loaded = self.load_extension( ext_path, package=package, recursive=recursive, store=store ) - loaded_extensions.update(loaded) if store else loaded_extensions.extend( - loaded + ( + loaded_extensions.update(loaded) + if store + else loaded_extensions.extend(loaded) ) return loaded_extensions diff --git a/discord/commands/core.py b/discord/commands/core.py index 6ba369c5d0..792adda6d7 100644 --- a/discord/commands/core.py +++ b/discord/commands/core.py @@ -910,8 +910,10 @@ async def _invoke(self, ctx: ApplicationContext) -> None: ): arg = ctx.guild.get_channel_or_thread(int(arg)) _data["_invoke_flag"] = True - arg._update(_data) if isinstance(arg, Thread) else arg._update( - ctx.guild, _data + ( + arg._update(_data) + if isinstance(arg, Thread) + else arg._update(ctx.guild, _data) ) else: obj_type = None diff --git a/discord/enums.py b/discord/enums.py index 8f880f24cc..75af244382 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -489,7 +489,9 @@ def category(self) -> AuditLogActionCategory | None: AuditLogAction.thread_create: AuditLogActionCategory.create, AuditLogAction.thread_update: AuditLogActionCategory.update, AuditLogAction.thread_delete: AuditLogActionCategory.delete, - AuditLogAction.application_command_permission_update: AuditLogActionCategory.update, + AuditLogAction.application_command_permission_update: ( + AuditLogActionCategory.update + ), AuditLogAction.auto_moderation_rule_create: AuditLogActionCategory.create, AuditLogAction.auto_moderation_rule_update: AuditLogActionCategory.update, AuditLogAction.auto_moderation_rule_delete: AuditLogActionCategory.delete, diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 91ebce653a..d3ce2e07db 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -2010,9 +2010,11 @@ def predicate(ctx): # ctx.guild is None doesn't narrow ctx.author to Member getter = functools.partial(discord.utils.get, ctx.author.roles) # type: ignore if any( - getter(id=item) is not None - if isinstance(item, int) - else getter(name=item) is not None + ( + getter(id=item) is not None + if isinstance(item, int) + else getter(name=item) is not None + ) for item in items ): return True @@ -2072,9 +2074,11 @@ def predicate(ctx): me = ctx.me getter = functools.partial(discord.utils.get, me.roles) if any( - getter(id=item) is not None - if isinstance(item, int) - else getter(name=item) is not None + ( + getter(id=item) is not None + if isinstance(item, int) + else getter(name=item) is not None + ) for item in items ): return True diff --git a/discord/ext/pages/pagination.py b/discord/ext/pages/pagination.py index 6bffc7e194..463992988b 100644 --- a/discord/ext/pages/pagination.py +++ b/discord/ext/pages/pagination.py @@ -766,11 +766,15 @@ def add_button(self, button: PaginatorButton): self.buttons[button.button_type] = { "object": discord.ui.Button( style=button.style, - label=button.label - if button.label or button.emoji - else button.button_type.capitalize() - if button.button_type != "page_indicator" - else f"{self.current_page + 1}/{self.page_count + 1}", + label=( + button.label + if button.label or button.emoji + else ( + button.button_type.capitalize() + if button.button_type != "page_indicator" + else f"{self.current_page + 1}/{self.page_count + 1}" + ) + ), disabled=button.disabled, custom_id=button.custom_id, emoji=button.emoji, @@ -778,9 +782,11 @@ def add_button(self, button: PaginatorButton): ), "label": button.label, "loop_label": button.loop_label, - "hidden": button.disabled - if button.button_type != "page_indicator" - else not self.show_indicator, + "hidden": ( + button.disabled + if button.button_type != "page_indicator" + else not self.show_indicator + ), } self.buttons[button.button_type]["object"].callback = button.callback button.paginator = self diff --git a/discord/gateway.py b/discord/gateway.py index e3e7d1bd65..d337dda69f 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -140,8 +140,10 @@ def run(self): while not self._stop_ev.wait(self.interval): if self._last_recv + self.heartbeat_timeout < time.perf_counter(): _log.warning( - "Shard ID %s has stopped responding to the gateway. Closing and" - " restarting.", + ( + "Shard ID %s has stopped responding to the gateway. Closing and" + " restarting." + ), self.shard_id, ) coro = self.ws.close(4000) diff --git a/discord/guild.py b/discord/guild.py index fb876be2d6..06fbc2ffd1 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -1140,9 +1140,11 @@ def _create_channel( "allow": allow.value, "deny": deny.value, "id": target.id, - "type": abc._Overwrites.ROLE - if isinstance(target, Role) - else abc._Overwrites.MEMBER, + "type": ( + abc._Overwrites.ROLE + if isinstance(target, Role) + else abc._Overwrites.MEMBER + ), } perms.append(payload) diff --git a/discord/http.py b/discord/http.py index 9759e45722..d70380cd4f 100644 --- a/discord/http.py +++ b/discord/http.py @@ -302,8 +302,10 @@ async def request( response, use_clock=self.use_clock ) _log.debug( - "A rate limit bucket has been exhausted (bucket: %s," - " retry: %s).", + ( + "A rate limit bucket has been exhausted (bucket:" + " %s, retry: %s)." + ), bucket, delta, ) @@ -334,8 +336,10 @@ async def request( is_global = data.get("global", False) if is_global: _log.warning( - "Global rate limit has been hit. Retrying in %.2f" - " seconds.", + ( + "Global rate limit has been hit. Retrying in" + " %.2f seconds." + ), retry_after, ) self._global_over.clear() diff --git a/discord/iterators.py b/discord/iterators.py index 2375b48677..78edb7570d 100644 --- a/discord/iterators.py +++ b/discord/iterators.py @@ -689,7 +689,6 @@ def create_member(self, data): class BanIterator(_AsyncIterator["BanEntry"]): def __init__(self, guild, limit=None, before=None, after=None): - self.guild = guild self.limit = limit self.after = after diff --git a/discord/opus.py b/discord/opus.py index abb64029d3..63362b929a 100644 --- a/discord/opus.py +++ b/discord/opus.py @@ -398,7 +398,7 @@ def set_bandwidth(self, req: BAND_CTL) -> None: if req not in band_ctl: raise KeyError( f"{req!r} is not a valid bandwidth setting. Try one of:" - f' {",".join(band_ctl)}' + f" {','.join(band_ctl)}" ) k = band_ctl[req] @@ -408,7 +408,7 @@ def set_signal_type(self, req: SIGNAL_CTL) -> None: if req not in signal_ctl: raise KeyError( f"{req!r} is not a valid bandwidth setting. Try one of:" - f' {",".join(signal_ctl)}' + f" {','.join(signal_ctl)}" ) k = signal_ctl[req] diff --git a/discord/partial_emoji.py b/discord/partial_emoji.py index 30832622ff..dd2d6fa04d 100644 --- a/discord/partial_emoji.py +++ b/discord/partial_emoji.py @@ -162,9 +162,8 @@ def _to_partial(self) -> PartialEmoji: def _to_forum_tag_payload( self, - ) -> ( - TypedDict("TagPayload", {"emoji_id": int, "emoji_name": None}) - | TypedDict("TagPayload", {"emoji_id": None, "emoji_name": str}) + ) -> TypedDict("TagPayload", {"emoji_id": int, "emoji_name": None}) | TypedDict( + "TagPayload", {"emoji_id": None, "emoji_name": str} ): if self.id is None: return {"emoji_id": None, "emoji_name": self.name} diff --git a/discord/state.py b/discord/state.py index 6cd46ba3ca..5ab2bc5615 100644 --- a/discord/state.py +++ b/discord/state.py @@ -554,8 +554,10 @@ async def query_members( return await asyncio.wait_for(request.wait(), timeout=30.0) except asyncio.TimeoutError: _log.warning( - "Timed out waiting for chunks with query %r and limit %d for" - " guild_id %d", + ( + "Timed out waiting for chunks with query %r and limit %d for" + " guild_id %d" + ), query, limit, guild_id, @@ -926,8 +928,10 @@ def parse_channel_pins_update(self, data) -> None: if channel is None: _log.debug( - "CHANNEL_PINS_UPDATE referencing an unknown channel ID: %s." - " Discarding.", + ( + "CHANNEL_PINS_UPDATE referencing an unknown channel ID: %s." + " Discarding." + ), channel_id, ) return @@ -1082,8 +1086,10 @@ def parse_thread_members_update(self, data) -> None: thread: Thread | None = guild.get_thread(thread_id) if thread is None: _log.debug( - "THREAD_MEMBERS_UPDATE referencing an unknown thread ID: %s." - " Discarding", + ( + "THREAD_MEMBERS_UPDATE referencing an unknown thread ID: %s." + " Discarding" + ), thread_id, ) return @@ -1201,8 +1207,10 @@ def parse_guild_stickers_update(self, data) -> None: guild = self._get_guild(int(data["guild_id"])) if guild is None: _log.debug( - "GUILD_STICKERS_UPDATE referencing an unknown guild ID: %s." - " Discarding.", + ( + "GUILD_STICKERS_UPDATE referencing an unknown guild ID: %s." + " Discarding." + ), data["guild_id"], ) return @@ -1415,8 +1423,10 @@ def parse_guild_scheduled_event_create(self, data) -> None: guild = self._get_guild(int(data["guild_id"])) if guild is None: _log.debug( - "GUILD_SCHEDULED_EVENT_CREATE referencing an unknown guild ID: %s." - " Discarding.", + ( + "GUILD_SCHEDULED_EVENT_CREATE referencing an unknown guild ID: %s." + " Discarding." + ), data["guild_id"], ) return @@ -1436,8 +1446,10 @@ def parse_guild_scheduled_event_update(self, data) -> None: guild = self._get_guild(int(data["guild_id"])) if guild is None: _log.debug( - "GUILD_SCHEDULED_EVENT_UPDATE referencing an unknown guild ID: %s." - " Discarding.", + ( + "GUILD_SCHEDULED_EVENT_UPDATE referencing an unknown guild ID: %s." + " Discarding." + ), data["guild_id"], ) return @@ -1458,8 +1470,10 @@ def parse_guild_scheduled_event_delete(self, data) -> None: guild = self._get_guild(int(data["guild_id"])) if guild is None: _log.debug( - "GUILD_SCHEDULED_EVENT_DELETE referencing an unknown guild ID: %s." - " Discarding.", + ( + "GUILD_SCHEDULED_EVENT_DELETE referencing an unknown guild ID: %s." + " Discarding." + ), data["guild_id"], ) return @@ -1480,8 +1494,10 @@ def parse_guild_scheduled_event_user_add(self, data) -> None: guild = self._get_guild(int(data["guild_id"])) if guild is None: _log.debug( - "GUILD_SCHEDULED_EVENT_USER_ADD referencing an unknown guild ID: %s." - " Discarding.", + ( + "GUILD_SCHEDULED_EVENT_USER_ADD referencing an unknown guild ID:" + " %s. Discarding." + ), data["guild_id"], ) return @@ -1502,8 +1518,10 @@ def parse_guild_scheduled_event_user_remove(self, data) -> None: guild = self._get_guild(int(data["guild_id"])) if guild is None: _log.debug( - "GUILD_SCHEDULED_EVENT_USER_REMOVE referencing an unknown guild ID: %s." - " Discarding.", + ( + "GUILD_SCHEDULED_EVENT_USER_REMOVE referencing an unknown guild ID:" + " %s. Discarding." + ), data["guild_id"], ) return @@ -1526,8 +1544,10 @@ def parse_guild_integrations_update(self, data) -> None: self.dispatch("guild_integrations_update", guild) else: _log.debug( - "GUILD_INTEGRATIONS_UPDATE referencing an unknown guild ID: %s." - " Discarding.", + ( + "GUILD_INTEGRATIONS_UPDATE referencing an unknown guild ID: %s." + " Discarding." + ), data["guild_id"], ) @@ -1611,8 +1631,10 @@ def parse_stage_instance_update(self, data) -> None: ) else: _log.debug( - "STAGE_INSTANCE_UPDATE referencing unknown stage instance ID: %s." - " Discarding.", + ( + "STAGE_INSTANCE_UPDATE referencing unknown stage instance ID:" + " %s. Discarding." + ), data["id"], ) else: @@ -1669,8 +1691,10 @@ def parse_voice_state_update(self, data) -> None: self.dispatch("voice_state_update", member, before, after) else: _log.debug( - "VOICE_STATE_UPDATE referencing an unknown member ID: %s." - " Discarding.", + ( + "VOICE_STATE_UPDATE referencing an unknown member ID: %s." + " Discarding." + ), data["user_id"], ) @@ -1831,8 +1855,10 @@ async def _delay_ready(self) -> None: else: if self._guild_needs_chunking(guild): _log.debug( - "Guild ID %d requires chunking, will be done in the" - " background.", + ( + "Guild ID %d requires chunking, will be done in the" + " background." + ), guild.id, ) if len(current_bucket) >= max_concurrency: @@ -1867,8 +1893,10 @@ async def _delay_ready(self) -> None: await utils.sane_wait_for(futures, timeout=timeout) except asyncio.TimeoutError: _log.warning( - "Shard ID %s failed to wait for chunks (timeout=%.2f) for %d" - " guilds", + ( + "Shard ID %s failed to wait for chunks (timeout=%.2f) for %d" + " guilds" + ), shard_id, timeout, len(guilds), diff --git a/discord/ui/select.py b/discord/ui/select.py index 73fd772213..5b373bd188 100644 --- a/discord/ui/select.py +++ b/discord/ui/select.py @@ -327,9 +327,13 @@ def append_option(self, option: SelectOption): @property def values( self, - ) -> list[str] | list[Member | User] | list[Role] | list[ - Member | User | Role - ] | list[GuildChannel | Thread]: + ) -> ( + list[str] + | list[Member | User] + | list[Role] + | list[Member | User | Role] + | list[GuildChannel | Thread] + ): """Union[List[:class:`str`], List[Union[:class:`discord.Member`, :class:`discord.User`]], List[:class:`discord.Role`]], List[Union[:class:`discord.Member`, :class:`discord.User`, :class:`discord.Role`]], List[:class:`discord.abc.GuildChannel`]]: A list of values that have been selected by the user. @@ -352,9 +356,11 @@ def values( ): result = guild.get_channel_or_thread(int(channel_id)) _data["_invoke_flag"] = True - result._update(_data) if isinstance( - result, Thread - ) else result._update(guild, _data) + ( + result._update(_data) + if isinstance(result, Thread) + else result._update(guild, _data) + ) else: # NOTE: # This is a fallback in case the channel/thread is not found in the diff --git a/discord/ui/view.py b/discord/ui/view.py index b2a208c98b..8172e726f8 100644 --- a/discord/ui/view.py +++ b/discord/ui/view.py @@ -444,7 +444,6 @@ def _dispatch_item(self, item: Item, interaction: Interaction): ) def refresh(self, components: list[Component]): - # This is pretty hacky at the moment old_state: dict[tuple[int, str], Item] = { (item.type.value, item.custom_id): item for item in self.children if item.is_dispatchable() # type: ignore diff --git a/discord/utils.py b/discord/utils.py index d4394658ec..20add93227 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -641,7 +641,7 @@ def _get_as_snowflake(data: Any, key: str) -> int | None: def _get_mime_type_for_image(data: bytes): - if data.startswith(b"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A"): + if data.startswith(b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a"): return "image/png" elif data[0:3] == b"\xff\xd8\xff" or data[6:10] in (b"JFIF", b"Exif"): return "image/jpeg" diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index e6e6fd827e..08b77a1b8c 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -181,8 +181,10 @@ async def request( if remaining == "0" and response.status != 429: delta = utils._parse_ratelimit_header(response) _log.debug( - "Webhook ID %s has been pre-emptively rate limited," - " waiting %.2f seconds", + ( + "Webhook ID %s has been pre-emptively rate limited," + " waiting %.2f seconds" + ), webhook_id, delta, ) @@ -197,8 +199,10 @@ async def request( retry_after: float = data["retry_after"] # type: ignore _log.warning( - "Webhook ID %s is rate limited. Retrying in %.2f" - " seconds", + ( + "Webhook ID %s is rate limited. Retrying in %.2f" + " seconds" + ), webhook_id, retry_after, ) diff --git a/discord/webhook/sync.py b/discord/webhook/sync.py index 940dc9e51f..042130ac25 100644 --- a/discord/webhook/sync.py +++ b/discord/webhook/sync.py @@ -187,8 +187,10 @@ def request( if remaining == "0" and response.status_code != 429: delta = utils._parse_ratelimit_header(response) _log.debug( - "Webhook ID %s has been pre-emptively rate limited," - " waiting %.2f seconds", + ( + "Webhook ID %s has been pre-emptively rate limited," + " waiting %.2f seconds" + ), webhook_id, delta, ) @@ -203,8 +205,10 @@ def request( retry_after: float = data["retry_after"] # type: ignore _log.warning( - "Webhook ID %s is rate limited. Retrying in %.2f" - " seconds", + ( + "Webhook ID %s is rate limited. Retrying in %.2f" + " seconds" + ), webhook_id, retry_after, ) diff --git a/docs/conf.py b/docs/conf.py index a3a7536b75..ab87ced36b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -36,6 +36,7 @@ """ ) + # Only write if it's changed to avoid recompiling the docs def write_new(): with open(new_changelog, "w") as fw: diff --git a/examples/basic_voice.py b/examples/basic_voice.py index fcda6ea6f7..2525415762 100644 --- a/examples/basic_voice.py +++ b/examples/basic_voice.py @@ -22,7 +22,9 @@ "quiet": True, "no_warnings": True, "default_search": "auto", - "source_address": "0.0.0.0", # Bind to ipv4 since ipv6 addresses cause issues at certain times + "source_address": ( + "0.0.0.0" + ), # Bind to ipv4 since ipv6 addresses cause issues at certain times } ffmpeg_options = {"options": "-vn"} diff --git a/examples/cooldown.py b/examples/cooldown.py index a02daaf3bd..ee25ac699d 100644 --- a/examples/cooldown.py +++ b/examples/cooldown.py @@ -11,6 +11,7 @@ ) bypassing_users = [] # used in the dynamic cooldown below + # An application command with cooldown @bot.slash_command() @commands.cooldown( diff --git a/examples/create_private_emoji.py b/examples/create_private_emoji.py index 287d09e2fb..66ce3823bf 100644 --- a/examples/create_private_emoji.py +++ b/examples/create_private_emoji.py @@ -10,6 +10,7 @@ # Discord doesn't support creating private emojis by default, its semi-implemented feature and can be done by bots only. + # This command is publicly available, to set up command permissions look for other examples in repo @bot.command(guild_ids=[...]) async def add_private_emoji( diff --git a/examples/views/channel_select.py b/examples/views/channel_select.py index df00614629..d00416f915 100644 --- a/examples/views/channel_select.py +++ b/examples/views/channel_select.py @@ -2,6 +2,7 @@ # Channel selects (dropdowns) are a new type of select menu/dropdown Discord has added so users can select channels from a dropdown. + # Defines a simple View that allows the user to use the Select menu. # In this view, we define the channel_select with `discord.ui.channel_select` # Using the decorator automatically sets `select_type` to `discord.ComponentType.channel_select`. diff --git a/examples/views/role_select.py b/examples/views/role_select.py index f2822e7b4c..89540b9663 100644 --- a/examples/views/role_select.py +++ b/examples/views/role_select.py @@ -2,6 +2,7 @@ # Role selects (dropdowns) are a new type of select menu/dropdown Discord has added so people can select server roles from a dropdown. + # Defines a simple View that allows the user to use the Select menu. # In this view, we define the role_select with `discord.ui.role_select` # Using the decorator automatically sets `select_type` to `discord.ComponentType.role_select`.