我希望我的机器人在有人键入不存在的命令时向聊天室发送消息。我试过了,但是什么也没发生。这是代码:
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix=BOT_PREFIX)
@bot.event
async def on_ready():
print("Logged in as: " + bot.user.name + "\n")
@bot.command()
async def asdasd(ctx):
try:
if asdasd:
await ctx.send('asd')
except discord.ext.commands.errors.CommandNotFound:
await ctx.send('error')
bot.run('My Token Here')