mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 12:18:59 +00:00
[commands] Add ForumChannelConverter converter
This commit is contained in:
parent
d98ee567d4
commit
141d9f4c71
@ -74,6 +74,7 @@ __all__ = (
|
|||||||
'EmojiConverter',
|
'EmojiConverter',
|
||||||
'PartialEmojiConverter',
|
'PartialEmojiConverter',
|
||||||
'CategoryChannelConverter',
|
'CategoryChannelConverter',
|
||||||
|
'ForumChannelConverter',
|
||||||
'IDConverter',
|
'IDConverter',
|
||||||
'ThreadConverter',
|
'ThreadConverter',
|
||||||
'GuildChannelConverter',
|
'GuildChannelConverter',
|
||||||
@ -580,6 +581,25 @@ class ThreadConverter(IDConverter[discord.Thread]):
|
|||||||
return GuildChannelConverter._resolve_thread(ctx, argument, 'threads', discord.Thread)
|
return GuildChannelConverter._resolve_thread(ctx, argument, 'threads', discord.Thread)
|
||||||
|
|
||||||
|
|
||||||
|
class ForumChannelConverter(IDConverter[discord.ForumChannel]):
|
||||||
|
"""Converts to a :class:`~discord.ForumChannel`.
|
||||||
|
|
||||||
|
All lookups are via the local guild. If in a DM context, then the lookup
|
||||||
|
is done by the global cache.
|
||||||
|
|
||||||
|
The lookup strategy is as follows (in order):
|
||||||
|
|
||||||
|
1. Lookup by ID.
|
||||||
|
2. Lookup by mention.
|
||||||
|
3. Lookup by name
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
"""
|
||||||
|
|
||||||
|
async def convert(self, ctx: Context[BotT], argument: str) -> discord.ForumChannel:
|
||||||
|
return GuildChannelConverter._resolve_channel(ctx, argument, 'forums', discord.ForumChannel)
|
||||||
|
|
||||||
|
|
||||||
class ColourConverter(Converter[discord.Colour]):
|
class ColourConverter(Converter[discord.Colour]):
|
||||||
"""Converts to a :class:`~discord.Colour`.
|
"""Converts to a :class:`~discord.Colour`.
|
||||||
|
|
||||||
|
@ -391,6 +391,7 @@ A lot of discord models work out of the gate as a parameter:
|
|||||||
- :class:`VoiceChannel`
|
- :class:`VoiceChannel`
|
||||||
- :class:`StageChannel` (since v1.7)
|
- :class:`StageChannel` (since v1.7)
|
||||||
- :class:`CategoryChannel`
|
- :class:`CategoryChannel`
|
||||||
|
- :class:`ForumChannel` (since v2.0)
|
||||||
- :class:`Invite`
|
- :class:`Invite`
|
||||||
- :class:`Guild` (since v1.7)
|
- :class:`Guild` (since v1.7)
|
||||||
- :class:`Role`
|
- :class:`Role`
|
||||||
@ -431,6 +432,8 @@ converter is given below:
|
|||||||
+--------------------------+-------------------------------------------------+
|
+--------------------------+-------------------------------------------------+
|
||||||
| :class:`CategoryChannel` | :class:`~ext.commands.CategoryChannelConverter` |
|
| :class:`CategoryChannel` | :class:`~ext.commands.CategoryChannelConverter` |
|
||||||
+--------------------------+-------------------------------------------------+
|
+--------------------------+-------------------------------------------------+
|
||||||
|
| :class:`ForumChannel` | :class:`~ext.commands.ForumChannelConverter` |
|
||||||
|
+--------------------------+-------------------------------------------------+
|
||||||
| :class:`Invite` | :class:`~ext.commands.InviteConverter` |
|
| :class:`Invite` | :class:`~ext.commands.InviteConverter` |
|
||||||
+--------------------------+-------------------------------------------------+
|
+--------------------------+-------------------------------------------------+
|
||||||
| :class:`Guild` | :class:`~ext.commands.GuildConverter` |
|
| :class:`Guild` | :class:`~ext.commands.GuildConverter` |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user