fix(bot): 🐛 DiscordUserID onverter not working with mentions.
This commit is contained in:
@@ -49,7 +49,7 @@ class Admin(base.Cog):
|
|||||||
for call in calls:
|
for call in calls:
|
||||||
for rs in call.call_rss:
|
for rs in call.call_rss:
|
||||||
if rs.channel.server_id in servers_count_map:
|
if rs.channel.server_id in servers_count_map:
|
||||||
servers_count_map[rs.channel.server.id] += 1
|
servers_count_map[rs.channel.server_id] += 1
|
||||||
|
|
||||||
else:
|
else:
|
||||||
servers_count_map[rs.channel.server_id] = 0
|
servers_count_map[rs.channel.server_id] = 0
|
||||||
|
|||||||
@@ -48,18 +48,13 @@ class DiscordUserID(converter.Converter):
|
|||||||
return int(argument)
|
return int(argument)
|
||||||
|
|
||||||
if len(argument) > 17 and argument[2:-1].isdecimal():
|
if len(argument) > 17 and argument[2:-1].isdecimal():
|
||||||
return int(argument)
|
return int(argument[2:-1])
|
||||||
|
|
||||||
if argument.startswith("https://discord.com/users/") or argument.startswith(
|
if argument.startswith("https://discord.com/users/") or argument.startswith(
|
||||||
"discord://-/users/"
|
"discord://-/users/"
|
||||||
):
|
):
|
||||||
return int(argument.split("?", 1)[0].rsplit("/", 1)[1])
|
return int(argument.split("?", 1)[0].rsplit("/", 1)[1])
|
||||||
|
|
||||||
user = await models.User.get_or_none(username=argument)
|
|
||||||
|
|
||||||
if user is not None:
|
|
||||||
return user.id
|
|
||||||
|
|
||||||
if argument.lower() in ["reply", "."]:
|
if argument.lower() in ["reply", "."]:
|
||||||
if ctx.message.reference is not None:
|
if ctx.message.reference is not None:
|
||||||
ref = ctx.message.reference
|
ref = ctx.message.reference
|
||||||
@@ -80,4 +75,9 @@ class DiscordUserID(converter.Converter):
|
|||||||
|
|
||||||
return msg.author.id
|
return msg.author.id
|
||||||
|
|
||||||
|
user = await models.User.get_or_none(username=argument)
|
||||||
|
|
||||||
|
if user is not None:
|
||||||
|
return user.id
|
||||||
|
|
||||||
raise converter.BadArgument()
|
raise converter.BadArgument()
|
||||||
|
|||||||
Reference in New Issue
Block a user