【发布时间】:2021-09-20 12:52:59
【问题描述】:
我有这个机器人,每次有人使用on_message 事件发送消息时都会检查,并且由于某种原因,机器人的其他命令似乎被忽略了。
我在删除检查消息的功能后发现了这一点,并且命令运行良好。
这是on_message事件代码:
@client.event
async def on_message(message):
text = message.content
chann = message.channel.id
yes1 = False
yes = False
for ide in ids:
if message.author.id == ide:
yes1 = True
for strf in comms:
if text.startswith(strf):
yes = True
if (yes == False) and (yes1 == False) and (chann == 822089739502616576) and (message.author.id != 769302967803183124):
print(message.author.id)
msg = await message.channel.send('lahne kel el commands ye bhim')
await message.delete()
await asyncio.sleep(2)
print('deleting message')
await msg.delete()
if yes and (message.author.id != 769302967803183124) and (message.channel.id == 331562608467509249):
print(message.author.id)
msg = await message.channel.send('mech lahne tekteb el commands ye bhim')
await message.delete()
await asyncio.sleep(2)
print('deletingmessage')
await msg.delete()
if yes1 and (chann == 331562608467509249) and (message.author.id != 769302967803183124):
await message.delete()
我不知道问题出在哪里。
【问题讨论】:
标签: discord discord.py bots