【发布时间】:2021-02-03 00:41:11
【问题描述】:
我是使用 python 编码的新手,我在使用此代码时遇到了问题。
@client.event
async def on_message(message):
if message.author == client.user:
return
if 'choose my pick' in message.content:
channel = message.channel
await channel.send('Que role tu ta?')
def check(m):
return m.content == 'top' or 'jg' or 'mid' or 'adc' or 'sup' and m.channel == channel
role = await client.wait_for('message', check=check)
sentence_start = random.choice(inu_exp)
iten = random.choice(itens)
if 'top' in role.content:
champion = random.choice(top_champs)
await channel.send(f'{sentence_start} {champion} de {iten}')
await client.process_commands(message)
它可以按我的意愿工作,当有人输入“选择我的选择”时,它会询问“Que role tu ta”,但它会询问很多次,并且它还会多次发送答案await channel.send(f'{sentence_start} {champion} de {iten}')。
这是输出:https://prnt.sc/y1cucv
我正在使用 python 3.8.6
【问题讨论】:
-
很确定你正在运行隐藏的python进程,打开任务管理器,找到并杀死它们,你也可以重新启动你的电脑
标签: python-3.x discord discord.py