我正在pycharm中运行它。我按下run键,它运行并没有错误,但是我不确定为什么它在不一致时不起作用,这是设置错误吗?
import discord
import random
import time
import asyncio
TOKEN = "*************************************************"
client = discord.Client()
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("Hello"):
await message.channel.send("Hi it is me KEVIN")
@client.event
async def on_ready():
print("running rn sir")
答案 0 :(得分:1)
如果您的代码看起来像在这里共享的,则是由于一些小错误。
我已更正代码,因此它应该可以工作
import discord
import random
import time
import asyncio
TOKEN = "*************************************************"
client = discord.Client()
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("Hello"):
await message.channel.send("Hi it is me KEVIN")
@client.event
async def on_ready():
print("running rn sir")
client.run(TOKEN, bot=True, reconnect=True)