2024-05-01 16:13:16 发布
网友
如何使我的Discord.py无法忽略来自具有特定角色的人的消息
我最近在我的Discord.py机器人中添加了一项功能
@client.event async def on_message(message): if message.content == "Blocked Word": await message.delete()
我希望这样,如果有人这样有我自己,有一个特定的角色,机器人将不会删除邮件
任何帮助都将不胜感激
下面是一些简单的代码,可以回答您的问题: 这是基于@Joshua Nixon的答案
@client.event() async def on_message(message): if 'role' in [role.name for role in message.author.roles]: #checks if the specified role is in the user's roles #do something else: #do something else
下面是一些简单的代码,可以回答您的问题: 这是基于@Joshua Nixon的答案
相关问题 更多 >
编程相关推荐