def convert(self, ctx, argument):
guild = ctx.message.guild
if not guild:
raise commands.NoPrivateMessage()
match = self._get_id_match(argument) or re.match(r'<@&([0-9]+)>$', argument)
params = dict(id=int(match.group(1))) if match else dict(name=argument)
result = discord.utils.get(guild.roles, **params)
if result is None:
return argument
return result
评论列表
文章目录