[英]Ban command on message discord.py
import discord
from discord.ext import commands
client = commands.Bot(command_prefix='sk?')
token = ""
@client.event
async def on_message():
if 'WORD' in message.content:
await member.ban(reason = WORD)
client.run(token)
我收到错误“取 0 位置 arguments 但给出 1”,我不知道我的代码有什么问题。
我尝试添加on_message(member):
和member = message.author()
if 'WORD' in message.content:
我不知道该做什么或我做错了什么。
它还说对于所有非常烦人的消息。
on_message
接受消息参数, member
也应该是message.author
@client.event
async def on_message(message):
if "WORD" in message.content:
await message.author.ban(reason="WORD")
# Remember to add `process_commands`
await client.process_commands(message)
您还应该在事件结束时添加process_commands
以便命令工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.