def convert(self, ctx, argument):
try:
m = await commands.MemberConverter().convert(ctx, argument)
can_execute = ctx.author.id == ctx.bot.owner_id or \
ctx.author == ctx.guild.owner or \
ctx.author.top_role > m.top_role
if not can_execute:
raise commands.BadArgument('You cannot do this action on this user due to role hierarchy.')
return m.id
except commands.BadArgument:
try:
return int(argument, base=10)
except ValueError:
raise commands.BadArgument(f"{argument} is not a valid member or member ID.") from None
评论列表
文章目录