告诉我如何解决这个问题?启动机器人时,它应该返回书面消息,但不返回:
import discord
from discord.ext import commands
client = discord.Client()
bot = commands.Bot(command_prefix='$')
@client.event
async def on_ready():
print('Бот запущен')
@bot.command()
async def foo(ctx, arg):
await ctx.send(arg)
也许您忘记指定令牌并启动机器人?我还建议将@client.event 中的客户端更改为@bot.event。使用 !foo (message) 之类的命令,机器人将返回一条消息。