import asyncio
import discord
from discord.ext import commands
from discord.ext.commands import Bot
import chalk
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
await bot.change_presence(game=discord.Game(name='Test'))
print("All systems online and working " + bot.user.name)
await bot.send_message(discord.Object(id=386518608550952965), "All systems online and working")
@bot.command(pass_context=True)
async def hel(ctx):
await bot.say("A help message is sent to user")
@bot.command
async def on_message(message):
if message.content.startswith("ping"):
await bot.send_message(message.channel, "Pong")
bot.run("TOKEN", bot=True)
我试图让我的不和谐测试服务器这方面的工作,但是当我用它这样的,只有第一个“on_ready”和!HEL命令作品,ping不打印任何东西,但是当我删除!hel命令代码部分时,ping可以工作,有什么方法可以让它们一起工作吗?前缀与非前缀的命令不是蟒蛇不和谐机器人一起工作
在'hel',是'sot.say'应该是'bot.say'? –
嗯,是的,我只是没有意识到这一点,我把这个普通名称改成了“bot”,使它看起来更简单并错误输入。这是在我的原代码 – Hera