首页 > 解决方案 > @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

你能帮我解决吗?谢谢!

https://i.stack.imgur.com/crJY8.png

标签: discorddiscord.py

解决方案


推荐阅读