mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-22 00:34:06 +00:00
[commands] Fall back to using Message.mentions in converters
Useful if there's no cache.
This commit is contained in:
parent
bbc50c92d0
commit
2e6882bd8c
@ -58,6 +58,8 @@ def _get_from_guilds(bot, getter, argument):
|
||||
return result
|
||||
return result
|
||||
|
||||
_utils_get = discord.utils.get
|
||||
|
||||
class Converter:
|
||||
"""The base class of custom converters that require the :class:`.Context`
|
||||
to be passed to be useful.
|
||||
@ -124,7 +126,7 @@ class MemberConverter(IDConverter):
|
||||
else:
|
||||
user_id = int(match.group(1))
|
||||
if guild:
|
||||
result = guild.get_member(user_id)
|
||||
result = guild.get_member(user_id) or _utils_get(ctx.message.mentions, id=user_id)
|
||||
else:
|
||||
result = _get_from_guilds(bot, 'get_member', user_id)
|
||||
|
||||
@ -152,7 +154,7 @@ class UserConverter(IDConverter):
|
||||
|
||||
if match is not None:
|
||||
user_id = int(match.group(1))
|
||||
result = ctx.bot.get_user(user_id)
|
||||
result = ctx.bot.get_user(user_id) or _utils_get(ctx.message.mentions, id=user_id)
|
||||
else:
|
||||
arg = argument
|
||||
# check for discriminator if it exists
|
||||
|
Loading…
x
Reference in New Issue
Block a user