所以,我一直在编写一个机器人程序更换python3.6.1和我遇到了一个问题。问题是,在我用bot连接到discord之后,我键入一个单词(cookie),它将使bot在discord服务器上执行一个操作。我使用的代码如下。以及错误代码
我的代码:
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
TimeoutError
Client = discord.Client() #Initialise Client
client = commands.Bot(command_prefix = "?") #Initialise client bot
@client.event
async def on_ready():
print("Bot is online and connected to Discord") #This will be called
# when the bot connects to the server
@client.event
async def on_message(message):
if message.content == "cookie":
await client.send_message(message.channel, "cookie")
client.run("my discord bot token")
终端错误:
^{pr2}$
目前没有回答
相关问题 更多 >
编程相关推荐