mod.py 文件源码

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

项目:dogbot 作者: slice 项目源码 文件源码
def attentionseek(self, ctx: DogbotContext, replace_with='??'):
        """
        Changes attention-seeking nicknames.

        This will change the nickname of anybody whose name starts with "!"
        to a name you specify. By default, they are renamed to "??".

        The renaming of attention-seekers is borrowed from the Discord API
        server.
        """
        attention_seekers = [m for m in ctx.guild.members if m.display_name.startswith('!')]
        succeeded = len(attention_seekers)
        for seeker in attention_seekers:
            try:
                await seeker.edit(nick=replace_with)
            except discord.HTTPException:
                succeeded -= 1
        failed_count = len(attention_seekers) - succeeded
        await ctx.send(f'Renamed {succeeded} attention seeker(s). Failed to rename {failed_count}.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号