roles.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:GAFBot 作者: DiNitride 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号