Port TiV changes applied to voice channels to stage channels (#6109)

This commit is contained in:
Jakub Kuczys
2023-05-03 01:05:44 +02:00
committed by GitHub
parent f1439a37c8
commit 2fe251ecf3
28 changed files with 213 additions and 95 deletions

View File

@@ -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]

View File

@@ -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.

View File

@@ -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:

View File

@@ -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