diff --git a/docs/cog_guides/core.rst b/docs/cog_guides/core.rst index 1a66dfef5..fcca56a6f 100644 --- a/docs/cog_guides/core.rst +++ b/docs/cog_guides/core.rst @@ -1173,7 +1173,7 @@ embedset channel .. code-block:: none - [p]embedset channel [enabled] + [p]embedset channel [enabled] **Description** @@ -1187,10 +1187,12 @@ If enabled is left blank, the setting will be unset and the guild default will b To see full evaluation order of embed settings, run ``[p]help embedset``. **Examples:** - - ``[p]embedset channel False`` - Disables embeds in this channel. - - ``[p]embedset channel`` - Resets value to use guild default. + - ``[p]embedset channel #text-channel False`` - Disables embeds in the #text-channel. + - ``[p]embedset channel #forum-channel disable`` - Disables embeds in the #forum-channel. + - ``[p]embedset channel #text-channel`` - Resets value to use guild default in the #text-channel. **Arguments:** + - ```` - The text, voice, stage, or forum channel to set embed setting for. - ``[enabled]`` - Whether to use embeds in this channel. Leave blank to reset to default. .. _core-command-embedset-command: diff --git a/docs/cog_guides/filter.rst b/docs/cog_guides/filter.rst index e8c9167d3..d429a12ae 100644 --- a/docs/cog_guides/filter.rst +++ b/docs/cog_guides/filter.rst @@ -115,11 +115,12 @@ Add words to the filter. Use double quotes to add sentences. Examples: - - ``[p]filter channel add word1 word2 word3`` - - ``[p]filter channel add "This is a sentence"`` + - ``[p]filter channel add #channel word1 word2 word3`` + - ``[p]filter channel add #channel "This is a sentence"`` **Arguments:** +- ```` The text, voice, stage, or forum channel to add filtered words to. - ``[words...]`` The words or sentences to filter. .. _filter-command-filter-channel-clear: @@ -164,7 +165,7 @@ filter channel remove .. code-block:: none - [p]filter channel remove [words...] + [p]filter channel remove [words...] **Description** @@ -173,11 +174,12 @@ Remove words from the filter. Use double quotes to remove sentences. Examples: - - ``[p]filter channel remove word1 word2 word3`` - - ``[p]filter channel remove "This is a sentence"`` + - ``[p]filter channel remove #channel word1 word2 word3`` + - ``[p]filter channel remove #channel "This is a sentence"`` **Arguments:** +- ```` The text, voice, stage, or forum channel to add filtered words to. - ``[words...]`` The words or sentences to no longer filter. .. _filter-command-filter-clear: diff --git a/docs/cog_permissions.rst b/docs/cog_permissions.rst index f9b263f7f..d161214bf 100644 --- a/docs/cog_permissions.rst +++ b/docs/cog_permissions.rst @@ -31,7 +31,7 @@ In terms of scope, global rules will be checked first, then server rules. For each of those, the first rule pertaining to one of the following models will be used: 1. User -2. Voice channel a user is connected to +2. Voice/stage channel a user is connected to 3. The channel command was issued in (parent channel in case of invocations in threads) 4. Channel category 5. Roles, highest to lowest diff --git a/docs/incompatible_changes/3.5.rst b/docs/incompatible_changes/3.5.rst index f43f14c14..7ea49c90d 100644 --- a/docs/incompatible_changes/3.5.rst +++ b/docs/incompatible_changes/3.5.rst @@ -325,19 +325,19 @@ Here's an example of a list of versions sorted using the new order (oldest versi - 3.5.0.post1 - 3.5.1 -``Red.get_owner_notification_destinations()`` may return a ``discord.VoiceChannel`` instance now -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``Red.get_owner_notification_destinations()`` may now return instances of ``discord.Voice/StageChannel`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -With the introduction of Text in Voice feature, we added the ability to add a voice channel +With the introduction of Text in Voice feature, we added the ability to add a voice/stage channel as an owner notifications destination. This means that `redbot.core.modlog.get_modlog_channel()` -may now return an instance of `discord.VoiceChannel`. +may now return instances of `discord.VoiceChannel` and `discord.StageChannel`. -``modlog.get_modlog_channel()`` may return a ``discord.VoiceChannel`` instance now -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``modlog.get_modlog_channel()`` may now return instances of ``discord.Voice/StageChannel`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ With the introduction of Text in Voice feature, we added the ability to set a modlog -channel to a voice channel. This means that `redbot.core.modlog.get_modlog_channel()` -may now return an instance of `discord.VoiceChannel`. +channel to a voice/stage channel. This means that `redbot.core.modlog.get_modlog_channel()` +may now return instances of `discord.VoiceChannel` and `discord.StageChannel`. ``menus.DEFAULT_CONTROLS`` and ``ReactionPredicate.*_EMOJIS`` use immutable types now ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/redbot/cogs/admin/admin.py b/redbot/cogs/admin/admin.py index d5bfeb3a5..73e2e5f8d 100644 --- a/redbot/cogs/admin/admin.py +++ b/redbot/cogs/admin/admin.py @@ -357,7 +357,10 @@ class Admin(commands.Cog): @announceset.command(name="channel") async def announceset_channel( - self, ctx, *, channel: Union[discord.TextChannel, discord.VoiceChannel] + self, + ctx, + *, + channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel], ): """Change the channel where the bot will send announcements.""" await self.config.guild(ctx.guild).announce_channel.set(channel.id) diff --git a/redbot/cogs/audio/core/abc.py b/redbot/cogs/audio/core/abc.py index 66483f974..bbf85e876 100644 --- a/redbot/cogs/audio/core/abc.py +++ b/redbot/cogs/audio/core/abc.py @@ -197,7 +197,13 @@ class MixinMeta(ABC): self, config: Config, ctx_or_channel: Optional[ - Union[Context, discord.TextChannel, discord.VoiceChannel, discord.Thread] + Union[ + Context, + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.Thread, + ] ], query: str, query_obj: Query, @@ -253,7 +259,10 @@ class MixinMeta(ABC): @abstractmethod def _has_notify_perms( - self, channel: Union[discord.TextChannel, discord.VoiceChannel, discord.Thread] + self, + channel: Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread + ], ) -> bool: raise NotImplementedError() diff --git a/redbot/cogs/audio/core/utilities/miscellaneous.py b/redbot/cogs/audio/core/utilities/miscellaneous.py index 959b61351..4e3edce30 100644 --- a/redbot/cogs/audio/core/utilities/miscellaneous.py +++ b/redbot/cogs/audio/core/utilities/miscellaneous.py @@ -100,7 +100,10 @@ class MiscellaneousUtilities(MixinMeta, metaclass=CompositeMetaClass): return await ctx.send(embed=embed) def _has_notify_perms( - self, channel: Union[discord.TextChannel, discord.VoiceChannel, discord.Thread] + self, + channel: Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread + ], ) -> bool: perms = channel.permissions_for(channel.guild.me) return all((can_user_send_messages_in(channel.guild.me, channel), perms.embed_links)) diff --git a/redbot/cogs/audio/core/utilities/validation.py b/redbot/cogs/audio/core/utilities/validation.py index 4ba82c96f..f75e527ed 100644 --- a/redbot/cogs/audio/core/utilities/validation.py +++ b/redbot/cogs/audio/core/utilities/validation.py @@ -61,7 +61,13 @@ class ValidationUtilities(MixinMeta, metaclass=CompositeMetaClass): self, config: Config, ctx_or_channel: Optional[ - Union[Context, discord.TextChannel, discord.VoiceChannel, discord.Thread] + Union[ + Context, + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.Thread, + ] ], query: str, query_obj: Query, diff --git a/redbot/cogs/cleanup/cleanup.py b/redbot/cogs/cleanup/cleanup.py index 783d9a315..88a38a27e 100644 --- a/redbot/cogs/cleanup/cleanup.py +++ b/redbot/cogs/cleanup/cleanup.py @@ -76,7 +76,11 @@ class Cleanup(commands.Cog): async def get_messages_for_deletion( *, channel: Union[ - discord.TextChannel, discord.VoiceChannel, discord.DMChannel, discord.Thread + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.DMChannel, + discord.Thread, ], number: Optional[int] = None, check: Callable[[discord.Message], bool] = lambda x: True, @@ -132,7 +136,11 @@ class Cleanup(commands.Cog): self, num: int, channel: Union[ - discord.TextChannel, discord.VoiceChannel, discord.DMChannel, discord.Thread + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.DMChannel, + discord.Thread, ], *, subtract_invoking: bool = False, @@ -153,7 +161,9 @@ class Cleanup(commands.Cog): @staticmethod async def get_message_from_reference( - channel: Union[discord.TextChannel, discord.VoiceChannel, discord.Thread], + channel: Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread + ], reference: discord.MessageReference, ) -> Optional[discord.Message]: message = None diff --git a/redbot/cogs/filter/filter.py b/redbot/cogs/filter/filter.py index 79a496dde..c8cc2c2d9 100644 --- a/redbot/cogs/filter/filter.py +++ b/redbot/cogs/filter/filter.py @@ -254,7 +254,9 @@ class Filter(commands.Cog): async def filter_channel_add( self, ctx: commands.Context, - channel: Union[discord.TextChannel, discord.VoiceChannel, discord.ForumChannel], + channel: Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.ForumChannel + ], *words: str, ): """Add words to the filter. @@ -267,7 +269,7 @@ class Filter(commands.Cog): **Arguments:** - - `` The text, voice, or forum channel to add filtered words to. + - `` The text, voice, stage, or forum channel to add filtered words to. - `[words...]` The words or sentences to filter. """ added = await self.add_to_filter(channel, words) @@ -281,7 +283,9 @@ class Filter(commands.Cog): async def filter_channel_remove( self, ctx: commands.Context, - channel: Union[discord.TextChannel, discord.VoiceChannel, discord.ForumChannel], + channel: Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.ForumChannel + ], *words: str, ): """Remove words from the filter. @@ -294,7 +298,7 @@ class Filter(commands.Cog): **Arguments:** - - `` The text, voice, or forum channel to add filtered words to. + - `` The text, voice, stage, or forum channel to add filtered words to. - `[words...]` The words or sentences to no longer filter. """ removed = await self.remove_from_filter(channel, words) @@ -368,7 +372,12 @@ class Filter(commands.Cog): self, guild: discord.Guild, channel: Optional[ - Union[discord.TextChannel, discord.VoiceChannel, discord.ForumChannel] + Union[ + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.ForumChannel, + ] ] = None, ) -> None: """Invalidate a cached pattern""" @@ -381,7 +390,11 @@ class Filter(commands.Cog): async def add_to_filter( self, server_or_channel: Union[ - discord.Guild, discord.TextChannel, discord.VoiceChannel, discord.ForumChannel + discord.Guild, + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.ForumChannel, ], words: list, ) -> bool: @@ -405,7 +418,11 @@ class Filter(commands.Cog): async def remove_from_filter( self, server_or_channel: Union[ - discord.Guild, discord.TextChannel, discord.VoiceChannel, discord.ForumChannel + discord.Guild, + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.ForumChannel, ], words: list, ) -> bool: @@ -430,7 +447,11 @@ class Filter(commands.Cog): self, text: str, server_or_channel: Union[ - discord.Guild, discord.TextChannel, discord.VoiceChannel, discord.Thread + discord.Guild, + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.Thread, ], ) -> Set[str]: if isinstance(server_or_channel, discord.Guild): diff --git a/redbot/cogs/mutes/mutes.py b/redbot/cogs/mutes/mutes.py index 180f941b6..1fcc5a253 100644 --- a/redbot/cogs/mutes/mutes.py +++ b/redbot/cogs/mutes/mutes.py @@ -860,7 +860,9 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass): async def notification_channel_set( self, ctx: commands.Context, - channel: Optional[Union[discord.TextChannel, discord.VoiceChannel]] = None, + channel: Optional[ + Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel] + ] = None, ): """ Set the notification channel for automatic unmute issues. diff --git a/redbot/cogs/permissions/permissions.py b/redbot/cogs/permissions/permissions.py index df08700ef..0db134a38 100644 --- a/redbot/cogs/permissions/permissions.py +++ b/redbot/cogs/permissions/permissions.py @@ -221,7 +221,7 @@ class Permissions(commands.Cog): "Global rules (set by the owner) are checked first, then rules set for servers. If " "multiple global or server rules apply to the case, the order they are checked in is:\n" " 1. Rules about a user.\n" - " 2. Rules about the voice channel a user is connected to.\n" + " 2. Rules about the voice/stage channel a user is connected to.\n" " 3. Rules about the channel or a parent of the thread a command was issued in.\n" " 4. Rules about a role the user has (The highest role they have with a rule will be " "used).\n" diff --git a/redbot/cogs/reports/reports.py b/redbot/cogs/reports/reports.py index c52350934..c04699168 100644 --- a/redbot/cogs/reports/reports.py +++ b/redbot/cogs/reports/reports.py @@ -107,7 +107,9 @@ class Reports(commands.Cog): @commands.admin_or_permissions(manage_guild=True) @reportset.command(name="output") async def reportset_output( - self, ctx: commands.Context, channel: Union[discord.TextChannel, discord.VoiceChannel] + self, + ctx: commands.Context, + channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel], ): """Set the channel where reports will be sent.""" await self.config.guild(ctx.guild).output_channel.set(channel.id) diff --git a/redbot/cogs/streams/streams.py b/redbot/cogs/streams/streams.py index c9fe2a0b6..60ceb619d 100644 --- a/redbot/cogs/streams/streams.py +++ b/redbot/cogs/streams/streams.py @@ -316,7 +316,7 @@ class Streams(commands.Cog): ctx: commands.Context, channel_name: str, discord_channel: Union[ - discord.TextChannel, discord.VoiceChannel + discord.TextChannel, discord.VoiceChannel, discord.StageChannel ] = commands.CurrentChannel, ): """Manage Twitch stream notifications.""" @@ -328,7 +328,7 @@ class Streams(commands.Cog): ctx: commands.Context, channel_name: str, discord_channel: Union[ - discord.TextChannel, discord.VoiceChannel + discord.TextChannel, discord.VoiceChannel, discord.StageChannel ] = commands.CurrentChannel, ): """Toggle alerts in this or the given channel for a Twitch stream.""" @@ -345,7 +345,7 @@ class Streams(commands.Cog): ctx: commands.Context, channel_name_or_id: str, discord_channel: Union[ - discord.TextChannel, discord.VoiceChannel + discord.TextChannel, discord.VoiceChannel, discord.StageChannel ] = commands.CurrentChannel, ): """Toggle alerts in this channel for a YouTube stream.""" @@ -357,7 +357,7 @@ class Streams(commands.Cog): ctx: commands.Context, channel_name: str, discord_channel: Union[ - discord.TextChannel, discord.VoiceChannel + discord.TextChannel, discord.VoiceChannel, discord.StageChannel ] = commands.CurrentChannel, ): """Toggle alerts in this channel for a Picarto stream.""" @@ -794,7 +794,7 @@ class Streams(commands.Cog): async def _send_stream_alert( self, stream, - channel: Union[discord.TextChannel, discord.VoiceChannel], + channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel], embed: discord.Embed, content: str = None, *, @@ -954,7 +954,7 @@ class Streams(commands.Cog): async def _get_mention_str( self, guild: discord.Guild, - channel: Union[discord.TextChannel, discord.VoiceChannel], + channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel], guild_data: dict, ) -> Tuple[str, List[discord.Role]]: """Returns a 2-tuple with the string containing the mentions, and a list of @@ -982,7 +982,9 @@ class Streams(commands.Cog): return " ".join(mentions), edited_roles async def filter_streams( - self, streams: list, channel: Union[discord.TextChannel, discord.VoiceChannel] + self, + streams: list, + channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel], ) -> list: filtered = [] for stream in streams: diff --git a/redbot/cogs/trivia/trivia.py b/redbot/cogs/trivia/trivia.py index 77d2dd5f7..de3611ab7 100644 --- a/redbot/cogs/trivia/trivia.py +++ b/redbot/cogs/trivia/trivia.py @@ -705,7 +705,10 @@ class Trivia(commands.Cog): await ctx.send(_("Saved Trivia list as {filename}.").format(filename=filename)) def _get_trivia_session( - self, channel: Union[discord.TextChannel, discord.VoiceChannel, discord.Thread] + self, + channel: Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread + ], ) -> TriviaSession: return next( (session for session in self.trivia_sessions if session.ctx.channel == channel), None diff --git a/redbot/cogs/warnings/warnings.py b/redbot/cogs/warnings/warnings.py index 63735f76d..acf842554 100644 --- a/redbot/cogs/warnings/warnings.py +++ b/redbot/cogs/warnings/warnings.py @@ -159,7 +159,7 @@ class Warnings(commands.Cog): async def warnchannel( self, ctx: commands.Context, - channel: Union[discord.TextChannel, discord.VoiceChannel] = None, + channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel] = None, ): """Set the channel where warnings should be sent to. diff --git a/redbot/core/_diagnoser.py b/redbot/core/_diagnoser.py index a8c32c60a..f51f69b43 100644 --- a/redbot/core/_diagnoser.py +++ b/redbot/core/_diagnoser.py @@ -38,7 +38,9 @@ class IssueDiagnoserBase: self, bot: Red, original_ctx: commands.Context, - channel: Union[discord.TextChannel, discord.VoiceChannel, discord.Thread], + channel: Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread + ], author: discord.Member, command: commands.Command, ) -> None: diff --git a/redbot/core/_settings_caches.py b/redbot/core/_settings_caches.py index 259a15dc8..8fdc2a216 100644 --- a/redbot/core/_settings_caches.py +++ b/redbot/core/_settings_caches.py @@ -156,7 +156,11 @@ class IgnoreManager: async def get_ignored_channel( self, channel: Union[ - discord.TextChannel, discord.VoiceChannel, discord.ForumChannel, discord.Thread + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.ForumChannel, + discord.Thread, ], check_category: bool = True, ) -> bool: @@ -188,6 +192,7 @@ class IgnoreManager: channel: Union[ discord.TextChannel, discord.VoiceChannel, + discord.StageChannel, discord.Thread, discord.ForumChannel, discord.CategoryChannel, diff --git a/redbot/core/bot.py b/redbot/core/bot.py index f4cb894eb..e12000c55 100644 --- a/redbot/core/bot.py +++ b/redbot/core/bot.py @@ -837,7 +837,10 @@ class Red( return False if guild: - assert isinstance(channel, (discord.TextChannel, discord.VoiceChannel, discord.Thread)) + assert isinstance( + channel, + (discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread), + ) if not can_user_send_messages_in(guild.me, channel): return False if not (await self.ignored_channel_or_guild(message)): @@ -1291,6 +1294,7 @@ class Red( channel: Union[ discord.TextChannel, discord.VoiceChannel, + discord.StageChannel, commands.Context, discord.User, discord.Member, @@ -1305,7 +1309,7 @@ class Red( Arguments --------- - channel : Union[`discord.TextChannel`, `discord.VoiceChannel`, `commands.Context`, `discord.User`, `discord.Member`, `discord.Thread`] + channel : Union[`discord.TextChannel`, `discord.VoiceChannel`, `discord.StageChannel`, `commands.Context`, `discord.User`, `discord.Member`, `discord.Thread`] The target messageable object to check embed settings for. Keyword Arguments @@ -1352,7 +1356,10 @@ class Red( "You cannot pass a GroupChannel, DMChannel, or PartialMessageable to this method." ) - if isinstance(channel, (discord.TextChannel, discord.VoiceChannel, discord.Thread)): + if isinstance( + channel, + (discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread), + ): channel_id = channel.parent_id if isinstance(channel, discord.Thread) else channel.id if check_permissions and not channel.permissions_for(channel.guild.me).embed_links: @@ -2075,7 +2082,9 @@ class Red( async def get_owner_notification_destinations( self, - ) -> List[Union[discord.TextChannel, discord.VoiceChannel, discord.User]]: + ) -> List[ + Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.User] + ]: """ Gets the users and channels to send to """ diff --git a/redbot/core/commands/context.py b/redbot/core/commands/context.py index 3363e4d26..bbd33b7d3 100644 --- a/redbot/core/commands/context.py +++ b/redbot/core/commands/context.py @@ -315,7 +315,11 @@ if TYPE_CHECKING or os.getenv("BUILDING_DOCS", False): ... @property - def channel(self) -> Union[discord.TextChannel, discord.VoiceChannel, discord.Thread]: + def channel( + self, + ) -> Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread + ]: ... @property diff --git a/redbot/core/commands/help.py b/redbot/core/commands/help.py index 1ca0d2d46..268e22945 100644 --- a/redbot/core/commands/help.py +++ b/redbot/core/commands/help.py @@ -889,7 +889,12 @@ class RedHelpFormatter(HelpFormatterABC): # We need to wrap this in a task to not block after-sending-help interactions. # The channel has to be TextChannel or Thread as we can't bulk-delete from DMs async def _delete_delay_help( - channel: Union[discord.TextChannel, discord.VoiceChannel, discord.Thread], + channel: Union[ + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.Thread, + ], messages: List[discord.Message], delay: int, ): diff --git a/redbot/core/commands/requires.py b/redbot/core/commands/requires.py index 5ef689536..ca455121c 100644 --- a/redbot/core/commands/requires.py +++ b/redbot/core/commands/requires.py @@ -73,6 +73,7 @@ _T = TypeVar("_T") GlobalPermissionModel = Union[ discord.User, discord.VoiceChannel, + discord.StageChannel, discord.TextChannel, discord.ForumChannel, discord.CategoryChannel, @@ -82,6 +83,7 @@ GlobalPermissionModel = Union[ GuildPermissionModel = Union[ discord.Member, discord.VoiceChannel, + discord.StageChannel, discord.TextChannel, discord.ForumChannel, discord.CategoryChannel, diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index a239f1588..e83095b3d 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -1371,7 +1371,9 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): async def embedset_channel( self, ctx: commands.Context, - channel: Union[discord.TextChannel, discord.VoiceChannel, discord.ForumChannel], + channel: Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.ForumChannel + ], enabled: bool = None, ): """ @@ -1387,10 +1389,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): **Examples:** - `[p]embedset channel #text-channel False` - Disables embeds in the #text-channel. - `[p]embedset channel #forum-channel disable` - Disables embeds in the #forum-channel. - - `[p]embedset channel #text-channel` - Resets value to use guild default in the #text-channel . + - `[p]embedset channel #text-channel` - Resets value to use guild default in the #text-channel. **Arguments:** - - `` - The text, voice, or forum channel to set embed setting for. + - `` - The text, voice, stage, or forum channel to set embed setting for. - `[enabled]` - Whether to use embeds in this channel. Leave blank to reset to default. """ if enabled is None: @@ -2709,7 +2711,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): async def modlogset_modlog( self, ctx: commands.Context, - channel: Union[discord.TextChannel, discord.VoiceChannel] = None, + channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel] = None, ): """Set a channel as the modlog. @@ -3713,7 +3715,10 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): @_set_ownernotifications.command(name="adddestination") async def _set_ownernotifications_adddestination( - self, ctx: commands.Context, *, channel: Union[discord.TextChannel, discord.VoiceChannel] + self, + ctx: commands.Context, + *, + channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel], ): """ Adds a destination text channel to receive owner notifications. @@ -3738,7 +3743,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): self, ctx: commands.Context, *, - channel: Union[discord.TextChannel, discord.VoiceChannel, int], + channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel, int], ): """ Removes a destination text channel from receiving owner notifications. @@ -4692,7 +4697,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): self, ctx: commands.Context, channel: Optional[ - Union[discord.TextChannel, discord.VoiceChannel, discord.Thread] + Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread] ] = commands.CurrentChannel, # avoid non-default argument following default argument by using empty param() member: Union[discord.Member, discord.User] = commands.param(), @@ -4716,7 +4721,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): if ctx.guild is None: await ctx.send( _( - "A text channel, voice channel, or thread needs to be passed" + "A text channel, voice channel, stage channel, or thread needs to be passed" " when using this command in DMs." ) ) @@ -5683,6 +5688,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): channel: Union[ discord.TextChannel, discord.VoiceChannel, + discord.StageChannel, discord.ForumChannel, discord.CategoryChannel, discord.Thread, @@ -5741,6 +5747,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): channel: Union[ discord.TextChannel, discord.VoiceChannel, + discord.StageChannel, discord.ForumChannel, discord.CategoryChannel, discord.Thread, @@ -5784,23 +5791,23 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic): async def count_ignored(self, ctx: commands.Context): category_channels: List[discord.CategoryChannel] = [] - channels: List[Union[discord.TextChannel, discord.VoiceChannel, discord.ForumChannel]] = [] + channels: List[ + Union[ + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.ForumChannel, + ] + ] = [] threads: List[discord.Thread] = [] if await self.bot._ignored_cache.get_ignored_guild(ctx.guild): return _("This server is currently being ignored.") - for channel in ctx.guild.text_channels: - if channel.category and channel.category not in category_channels: - if await self.bot._ignored_cache.get_ignored_channel(channel.category): - category_channels.append(channel.category) - if await self.bot._ignored_cache.get_ignored_channel(channel, check_category=False): - channels.append(channel) - for channel in ctx.guild.voice_channels: - if channel.category and channel.category not in category_channels: - if await self.bot._ignored_cache.get_ignored_channel(channel.category): - category_channels.append(channel.category) - if await self.bot._ignored_cache.get_ignored_channel(channel, check_category=False): - channels.append(channel) - for channel in ctx.guild.forums: + for channel in itertools.chain( + ctx.guild.text_channels, + ctx.guild.voice_channels, + ctx.guild.stage_channels, + ctx.guild.forums, + ): if channel.category and channel.category not in category_channels: if await self.bot._ignored_cache.get_ignored_channel(channel.category): category_channels.append(channel.category) diff --git a/redbot/core/modlog.py b/redbot/core/modlog.py index 8e0f8185a..7c23a67fc 100644 --- a/redbot/core/modlog.py +++ b/redbot/core/modlog.py @@ -649,7 +649,7 @@ class Case: @classmethod async def from_json( cls, - mod_channel: Union[discord.TextChannel, discord.VoiceChannel], + mod_channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel], bot: Red, case_number: int, data: dict, @@ -659,7 +659,7 @@ class Case: Parameters ---------- - mod_channel: `discord.TextChannel` or `discord.VoiceChannel` + mod_channel: `discord.TextChannel` or `discord.VoiceChannel`, `discord.StageChannel` The mod log channel for the guild bot: Red The bot's instance. Needed to get the target user @@ -1252,7 +1252,7 @@ async def register_casetypes(new_types: List[dict]) -> List[CaseType]: async def get_modlog_channel( guild: discord.Guild, -) -> Union[discord.TextChannel, discord.VoiceChannel]: +) -> Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel]: """ Get the current modlog channel. @@ -1263,7 +1263,7 @@ async def get_modlog_channel( Returns ------- - `discord.TextChannel` or `discord.VoiceChannel` + `discord.TextChannel`, `discord.VoiceChannel`, or `discord.StageChannel` The channel object representing the modlog channel. Raises @@ -1283,7 +1283,8 @@ async def get_modlog_channel( async def set_modlog_channel( - guild: discord.Guild, channel: Union[discord.TextChannel, discord.VoiceChannel, None] + guild: discord.Guild, + channel: Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel, None], ) -> bool: """ Changes the modlog channel @@ -1292,7 +1293,7 @@ async def set_modlog_channel( ---------- guild: `discord.Guild` The guild to set a mod log channel for - channel: `discord.TextChannel`, `discord.VoiceChannel`, or `None` + channel: `discord.TextChannel`, `discord.VoiceChannel`, `discord.StageChannel`, or `None` The channel to be set as modlog channel Returns diff --git a/redbot/core/utils/__init__.py b/redbot/core/utils/__init__.py index 20d507682..16edae454 100644 --- a/redbot/core/utils/__init__.py +++ b/redbot/core/utils/__init__.py @@ -35,7 +35,11 @@ from redbot.core import commands if TYPE_CHECKING: GuildMessageable = Union[ - commands.GuildContext, discord.TextChannel, discord.VoiceChannel, discord.Thread + commands.GuildContext, + discord.TextChannel, + discord.VoiceChannel, + discord.StageChannel, + discord.Thread, ] DMMessageable = Union[commands.DMContext, discord.Member, discord.User, discord.DMChannel] diff --git a/redbot/core/utils/mod.py b/redbot/core/utils/mod.py index f795a459f..b653efefe 100644 --- a/redbot/core/utils/mod.py +++ b/redbot/core/utils/mod.py @@ -21,7 +21,9 @@ __all__ = ( async def mass_purge( messages: List[discord.Message], - channel: Union[discord.TextChannel, discord.VoiceChannel, discord.Thread], + channel: Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread + ], *, reason: Optional[str] = None, ): @@ -39,7 +41,7 @@ async def mass_purge( ---------- messages : `list` of `discord.Message` The messages to bulk delete. - channel : `discord.TextChannel`, `discord.VoiceChannel`, or `discord.Thread` + channel : `discord.TextChannel`, `discord.VoiceChannel`, `discord.StageChannel`, or `discord.Thread` The channel to delete messages from. reason : `str`, optional The reason for bulk deletion, which will appear in the audit log. diff --git a/redbot/core/utils/predicates.py b/redbot/core/utils/predicates.py index d6d22dfb1..5c4bdd255 100644 --- a/redbot/core/utils/predicates.py +++ b/redbot/core/utils/predicates.py @@ -317,7 +317,9 @@ class MessagePredicate(Callable[[discord.Message], bool]): def valid_role( cls, ctx: Optional[commands.Context] = None, - channel: Optional[Union[discord.TextChannel, discord.VoiceChannel, discord.Thread]] = None, + channel: Optional[ + Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread] + ] = None, user: Optional[discord.abc.User] = None, ) -> "MessagePredicate": """Match if the response refers to a role in the current guild. @@ -330,7 +332,7 @@ class MessagePredicate(Callable[[discord.Message], bool]): ---------- ctx : Optional[Context] Same as ``ctx`` in :meth:`same_context`. - channel : Optional[Union[`discord.TextChannel`, `discord.VoiceChannel`, `discord.Thread`]] + channel : Optional[Union[`discord.TextChannel`, `discord.VoiceChannel`, `discord.StageChannel`, `discord.Thread`]] Same as ``channel`` in :meth:`same_context`. user : Optional[discord.abc.User] Same as ``user`` in :meth:`same_context`. @@ -361,7 +363,9 @@ class MessagePredicate(Callable[[discord.Message], bool]): def valid_member( cls, ctx: Optional[commands.Context] = None, - channel: Optional[Union[discord.TextChannel, discord.VoiceChannel, discord.Thread]] = None, + channel: Optional[ + Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread] + ] = None, user: Optional[discord.abc.User] = None, ) -> "MessagePredicate": """Match if the response refers to a member in the current guild. @@ -374,7 +378,7 @@ class MessagePredicate(Callable[[discord.Message], bool]): ---------- ctx : Optional[Context] Same as ``ctx`` in :meth:`same_context`. - channel : Optional[Union[`discord.TextChannel`, `discord.VoiceChannel`, `discord.Thread`]] + channel : Optional[Union[`discord.TextChannel`, `discord.VoiceChannel`, `discord.StageChannel`, `discord.Thread`]] Same as ``channel`` in :meth:`same_context`. user : Optional[discord.abc.User] Same as ``user`` in :meth:`same_context`. @@ -409,7 +413,9 @@ class MessagePredicate(Callable[[discord.Message], bool]): def valid_text_channel( cls, ctx: Optional[commands.Context] = None, - channel: Optional[Union[discord.TextChannel, discord.VoiceChannel, discord.Thread]] = None, + channel: Optional[ + Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread] + ] = None, user: Optional[discord.abc.User] = None, ) -> "MessagePredicate": """Match if the response refers to a text channel in the current guild. @@ -422,7 +428,7 @@ class MessagePredicate(Callable[[discord.Message], bool]): ---------- ctx : Optional[Context] Same as ``ctx`` in :meth:`same_context`. - channel : Optional[Union[`discord.TextChannel`, `discord.VoiceChannel`, `discord.Thread`]] + channel : Optional[Union[`discord.TextChannel`, `discord.VoiceChannel`, `discord.StageChannel`, `discord.Thread`]] Same as ``channel`` in :meth:`same_context`. user : Optional[discord.abc.User] Same as ``user`` in :meth:`same_context`. @@ -457,7 +463,9 @@ class MessagePredicate(Callable[[discord.Message], bool]): def has_role( cls, ctx: Optional[commands.Context] = None, - channel: Optional[Union[discord.TextChannel, discord.VoiceChannel, discord.Thread]] = None, + channel: Optional[ + Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread] + ] = None, user: Optional[discord.abc.User] = None, ) -> "MessagePredicate": """Match if the response refers to a role which the author has. @@ -471,7 +479,7 @@ class MessagePredicate(Callable[[discord.Message], bool]): ---------- ctx : Optional[Context] Same as ``ctx`` in :meth:`same_context`. - channel : Optional[Union[`discord.TextChannel`, `discord.VoiceChannel`, `discord.Thread`]] + channel : Optional[Union[`discord.TextChannel`, `discord.VoiceChannel`, `discord.StageChannel`, `discord.Thread`]] Same as ``channel`` in :meth:`same_context`. user : Optional[discord.abc.User] Same as ``user`` in :meth:`same_context`. @@ -833,7 +841,9 @@ class MessagePredicate(Callable[[discord.Message], bool]): @staticmethod def _get_guild( ctx: Optional[commands.Context], - channel: Optional[Union[discord.TextChannel, discord.VoiceChannel, discord.Thread]], + channel: Optional[ + Union[discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread] + ], user: Optional[discord.Member], ) -> discord.Guild: if ctx is not None: diff --git a/redbot/core/utils/tunnel.py b/redbot/core/utils/tunnel.py index 5c38f1192..e66ecd804 100644 --- a/redbot/core/utils/tunnel.py +++ b/redbot/core/utils/tunnel.py @@ -59,7 +59,7 @@ class Tunnel(metaclass=TunnelMeta): ---------- sender: `discord.Member` The person who opened the tunnel - origin: `discord.TextChannel`, `discord.VoiceChannel`, or `discord.Thread` + origin: `discord.TextChannel`, `discord.VoiceChannel`, `discord.StageChannel`, or `discord.Thread` The channel in which it was opened recipient: `discord.User` The user on the other end of the tunnel @@ -69,7 +69,9 @@ class Tunnel(metaclass=TunnelMeta): self, *, sender: discord.Member, - origin: Union[discord.TextChannel, discord.VoiceChannel, discord.Thread], + origin: Union[ + discord.TextChannel, discord.VoiceChannel, discord.StageChannel, discord.Thread + ], recipient: discord.User, ): self.sender = sender