mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 23:15:48 +00:00
[commands] Add ForumChannelConverter converter
This commit is contained in:
parent
d98ee567d4
commit
141d9f4c71
@ -74,6 +74,7 @@ __all__ = (
|
||||
'EmojiConverter',
|
||||
'PartialEmojiConverter',
|
||||
'CategoryChannelConverter',
|
||||
'ForumChannelConverter',
|
||||
'IDConverter',
|
||||
'ThreadConverter',
|
||||
'GuildChannelConverter',
|
||||
@ -580,6 +581,25 @@ class ThreadConverter(IDConverter[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]):
|
||||
"""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:`StageChannel` (since v1.7)
|
||||
- :class:`CategoryChannel`
|
||||
- :class:`ForumChannel` (since v2.0)
|
||||
- :class:`Invite`
|
||||
- :class:`Guild` (since v1.7)
|
||||
- :class:`Role`
|
||||
@ -431,6 +432,8 @@ converter is given below:
|
||||
+--------------------------+-------------------------------------------------+
|
||||
| :class:`CategoryChannel` | :class:`~ext.commands.CategoryChannelConverter` |
|
||||
+--------------------------+-------------------------------------------------+
|
||||
| :class:`ForumChannel` | :class:`~ext.commands.ForumChannelConverter` |
|
||||
+--------------------------+-------------------------------------------------+
|
||||
| :class:`Invite` | :class:`~ext.commands.InviteConverter` |
|
||||
+--------------------------+-------------------------------------------------+
|
||||
| :class:`Guild` | :class:`~ext.commands.GuildConverter` |
|
||||
|
Loading…
x
Reference in New Issue
Block a user