[英]Can I get auto mod to detect the author of a message? dicord.py
我做了一个自动修改程序,它将删除包含被禁止的单词的消息,但是,我找不到一种方法来检测谁发送了该消息,因此可以将其静音。 有没有办法做到这一点? 这是我尝试过的代码:
@client.event
async def on_message(msg):
for word in bad_words:
if word in msg.content:
@client.event(aliases=['b'])
async def bad(ctx, *, user_name):
user_name = await ctx.message.author.name
await msg.delete()
await msg.channel.send("Do not use banned words!")
我做了一个自动修改程序,它将删除包含被禁止的单词的消息,但是,我找不到一种方法来检测谁发送了该消息,因此可以将其静音。 有没有办法做到这一点? 这是我尝试过的代码:
@client.event
async def on_message(msg):
for word in bad_words:
if word in msg.content:
@client.event(aliases=['b'])
async def bad(ctx, *, user_name):
user_name = await ctx.message.author.name
await msg.delete()
await msg.channel.send("Do not use banned words!")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.