discord - @client.command 没有运行,discord.py
问题描述
这是我的代码。
import discord
import os
import random
import asyncio
from discord import channel
from dotenv import load_dotenv
from neuralintents import GenericAssistant
from discord.ext import commands
chatbot = GenericAssistant('intents.json')
chatbot.train_model()
chatbot.save_model()
print("Bot running...")
client = commands.Bot(command_prefix="<")
load_dotenv()
TOKEN = os.getenv('token')
@client.event
async def on_ready():
print("Bot is ready!")
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("jag"):
response = chatbot.request(message.content[4:])
await message.channel.send(response)
@client.command()
async def hello(ctx):
await ctx.send("hi!")
client.run("token")
我不知道我的错误在哪里。它同时打印Bot running...
和Bot is ready!
但是当我运行命令时,它不响应它。那是<hello
。
你能帮我解决吗?谢谢!
解决方案
推荐阅读
- arrays - 关于在地图功能中提供键的警告,但我已经有一个关于空格的警告
- reactjs - React 路由器在 nginx 中无法正常工作
- mysql - 通过比较 2 个表值选择查询
- python - Spyder 编译器显示错误的输出
- python-3.x - 数据框/列顺序问题
- unity3d - 即使在清醒时也能播放声音是未勾选的统一
- java - 这种递归和回溯在 LeetCode 中是如何工作的?
- raku - 为什么 Duration.new 可以与 Int 一起使用,但不能与 Rat 一起使用?
- python - 对文件夹中的多个 CSV 文件进行相同的操作(2.0 版)
- reactjs - 在 React 中每次单击时触发 Animate.css 动画