mod.py 文件源码

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

项目:dogbot 作者: slice 项目源码 文件源码
def pingrole(self, ctx, role: discord.Role, *, message):
        """
        Temporarily edits a role to be pingable, sends a message mentioning said role, then edits it to be
        unpingable.

        The role must be below my highest role.
        """
        if role.position >= ctx.guild.me.top_role.position:
            return await ctx.send("I can't edit that role because it's above my highest role.")

        try:
            await role.edit(mentionable=True, reason=f'Pingrole by {describe(ctx.author)}')
            await ctx.send(f'{role.mention}: {message}')
        finally:
            try:
                await role.edit(mentionable=False, reason=f'Pingrole by {describe(ctx.author)}')
            except discord.HTTPException:
                pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号