【发布时间】:2021-09-23 21:47:25
【问题描述】:
命令不起作用,但尝试覆盖我的 on_message 的事件,但这不起作用。当我注释掉第二个client.event 并向下client.command 工作。知道我可能做错了什么吗?我错过了什么吗?
import discord
from discord.ext import commands
import random
import time
from datetime import date
client = commands.Bot(command_prefix = '.')
#client = discord.Client()
@client.event
async def on_ready():
print('we have logged in as {0.user}'.format(client))
@client.command()
async def clr(ctx, amount=5):
await ctx.channel.purge(limit=amount)
@client.command(aliases =['should', 'will'])
async def _8ball(ctx):
responses =['As i see it, yes.',
'Ask again later.',
'Better not tell you now.',
"Don't count on it",
'Yes!']
await ctx.send(random.choice(responses))
@client.event()
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('hello'):
await message.channel.send('Hello how are you?')
【问题讨论】:
标签: python discord discord.py