on_member_update获取角色添加/删除的名称

时间:2018-11-28 16:15:23

标签: python python-3.x discord.py discord.py-rewrite

所以我试图制作一个日志系统,但是我似乎无法获得更新的角色名称。我将如何去做?

    async def on_member_update(self, before, after):
    if before.nick != after.nick:
        cc = self.bot.get_channel(497404990076485663)
        ccc = discord.Embed(title=' ', description=f'{before.mention} **has changed their nickname from** `{before.nick}` **to** `{after.nick}`', color=0x00aad4)
        ccc.timestamp = datetime.datetime.utcnow()
        await cc.send(embed=ccc)
    elif before.roles != after.roles:
        cc = self.bot.get_channel(497404990076485663)
        csc = discord.Embed(title=' ', description=f"**{before.mention}'s role has been changed. Role add/removed:** {after.roles.name}", color=0x00aad4)
        csc.timestamp = datetime.datetime.utcnow()
        await cc.send(embed=csc)

0 个答案:

没有答案