1 回答

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超7個(gè)贊
該行不會(huì)暫停執(zhí)行直到滿足msg = await client.wait_for('message', check=check)條件嗎?m.content == 'yes'這應(yīng)該效果更好:
@client.command()
@has_permissions(administrator=True)
async def nuke(ctx, channel_name):
channel_id = int(''.join(i for i in channel_name if i.isdigit()))
existing_channel = client.get_channel(channel_id)
await ctx.send("Please confirm nuke: type yes or no")
def check(m):
return m.content == 'yes' or m.content == 'no'
msg = await client.wait_for('message', check=check)
if msg.content == 'yes':
if existing_channel is not None:
await existing_channel.clone(reason="Has been nuked")
await existing_channel.delete()
else:
await ctx.send(f'No channel named **{channel_name}** was found')
elif msg.content == 'no':
await ctx.send("Nuke has been canceled")
- 1 回答
- 0 關(guān)注
- 138 瀏覽
添加回答
舉報(bào)