mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-05 18:58:53 -05:00
Port TiV changes applied to voice channels to stage channels (#6109)
This commit is contained in:
parent
f1439a37c8
commit
2fe251ecf3
@ -1173,7 +1173,7 @@ embedset channel
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
[p]embedset channel [enabled]
|
||||
[p]embedset channel <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:**
|
||||
- ``<channel>`` - 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:
|
||||
|
||||
@ -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:**
|
||||
|
||||
- ``<channel>`` 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 <channel> [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:**
|
||||
|
||||
- ``<channel>`` 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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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()
|
||||
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:**
|
||||
|
||||
- `<channel>` The text, voice, or forum channel to add filtered words to.
|
||||
- `<channel>` 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:**
|
||||
|
||||
- `<channel>` The text, voice, or forum channel to add filtered words to.
|
||||
- `<channel>` 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):
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
"""
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
):
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
):
|
||||
"""
|
||||
@ -1390,7 +1392,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
||||
- `[p]embedset channel #text-channel` - Resets value to use guild default in the #text-channel.
|
||||
|
||||
**Arguments:**
|
||||
- `<channel>` - The text, voice, or forum channel to set embed setting for.
|
||||
- `<channel>` - 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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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]
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user