【发布时间】:2020-12-01 04:28:39
【问题描述】:
我正在尝试让我的 Discord 机器人说些什么,并在创建频道等时等待消息,但我不知道该怎么做,这是我现在正在处理的代码:
import discord, asyncio
discord_token = open('token.txt').read()
client = discord.Client()
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.lower().startswith('test'):
await message.channel.send('testing, sending to channel works!')
@client.event
async def on_ready():
print('Successfully connected to', client.user)
client.run(discord_token)
【问题讨论】:
标签: discord.py