【发布时间】:2022-01-03 08:16:31
【问题描述】:
我正在尝试让我的不和谐机器人随机向频道发送消息,到目前为止,这是我的代码:
@client.event
async def on_message(message):
if (random.randint(0,500) == 42) and (message.author != client.user):
await message.channel.send("bruh")
elif (random.randint(0,500) == 69) and (message.author != client.user):
await message.channel.send("good plan")
elif (random.randint(0,500) == 99) and (message.author != client.user):
await message.channel.send("awwww hellll nahhhhhhh")
elif (random.randint(0,500) == 76) and (message.author != client.user):
await message.channel.send("I think we should see other people...")
elif (random.randint(0,500) == 25) and (message.author != client.user):
await message.channel.send("no.")
elif (random.randint(0,500) == 56) and (message.author != client.user):
await message.channel.send("bad idea")
else:
return
每次我使用这段代码运行机器人时,我的命令都不起作用。我该怎么办?
【问题讨论】:
标签: python discord discord.py bots