Python 我正在提出一个建议。它第一次运行得非常好,之后,它会自动选择一个表情符号并将其发回 @bot.command() 异步定义建议(ctx,*,建议): #等待ctx通道净化(限值=1) 表情符号=['✅','❌'] 通道=机器人获取通道(XXXXXXXXXXXXX) 等待ctx.send('您的建议已发送,不久将由管理员审核') suggestEmbed=discord.Embed(颜色=0x28da5b) suggestEmbed=discord.Embed(title=“Suggestbot”,description=“请标记✅ 或❌ 取决于您是否接受此建议”,color=0x28da5b) message=wait channel.send(嵌入=suggestEmbed) 等待消息。添加反应('✅') 等待消息。添加反应('❌') sendEmbed=discord.Embed(颜色=0x28da5b) 添加_字段(名称='New Suggestion!',值=f'{Suggestion}') 尝试: 反应,用户=等待机器人。等待('reaction\u add') 而reaction.message==消息: 如果str(reaction.emoji)=”✅": wait ctx.send(“

Python 我正在提出一个建议。它第一次运行得非常好,之后,它会自动选择一个表情符号并将其发回 @bot.command() 异步定义建议(ctx,*,建议): #等待ctx通道净化(限值=1) 表情符号=['✅','❌'] 通道=机器人获取通道(XXXXXXXXXXXXX) 等待ctx.send('您的建议已发送,不久将由管理员审核') suggestEmbed=discord.Embed(颜色=0x28da5b) suggestEmbed=discord.Embed(title=“Suggestbot”,description=“请标记✅ 或❌ 取决于您是否接受此建议”,color=0x28da5b) message=wait channel.send(嵌入=suggestEmbed) 等待消息。添加反应('✅') 等待消息。添加反应('❌') sendEmbed=discord.Embed(颜色=0x28da5b) 添加_字段(名称='New Suggestion!',值=f'{Suggestion}') 尝试: 反应,用户=等待机器人。等待('reaction\u add') 而reaction.message==消息: 如果str(reaction.emoji)=”✅": wait ctx.send(“,python,discord,discord.py,bots,Python,Discord,Discord.py,Bots,因为你没有定义一个检查,它还接受机器人的反应输入。定义了一个检查函数 @bot.command() async def suggest(ctx,*,suggestion): # await ctx.channel.purge(limit = 1) emojis = ['✅','❌'] channel = bot.get_channel(xxxxxxxxxxxx) await ctx.send('Your Suggestion has been

因为你没有定义一个
检查
,它还接受机器人的反应输入。定义了一个检查函数

@bot.command()
async def suggest(ctx,*,suggestion):
    # await ctx.channel.purge(limit = 1)
    
    emojis = ['✅','❌']
    
    channel = bot.get_channel(xxxxxxxxxxxx)
    await ctx.send('Your Suggestion has been sent, will be reviewed by admin shortly')
    suggestEmbed = discord.Embed(colour=0x28da5b)
    suggestEmbed=discord.Embed(title="Suggestion Bot", description="Please mark ✅ or ❌ depending on whether you want to take this suggestion or not", color=0x28da5b)
    
    message = await channel.send(embed = suggestEmbed)
    await message.add_reaction('✅')
    await message.add_reaction('❌')
    
    sendEmbed = discord.Embed(colour = 0x28da5b)
    sendEmbed.add_field(name = 'New Suggestion!', value  = f'{suggestion}')

    
    try:
        reaction, user = await bot.wait_for('reaction_add')
        while reaction.message == message:
            if str(reaction.emoji) == "✅":
                await ctx.send("since you haven't defined a 
check
, it's also taking the bot's input of reactions. defined a check function

def check (reaction, user): 
         return not user.bot and message == reaction.message #checks if the reacting user isn't a bot (inside the command)

#use this with check kwarg inside wait_for

reaction, user = await bot.wait_for('reaction_add', check=check)
最终代码:

bot.remove_命令(“建议”)
@bot.command()
异步定义建议(ctx,*,建议):
#等待ctx通道净化(限值=1)
表情符号=['✅','❌']
频道=ctx.channel
等待ctx.send('您的建议已发送,不久将由管理员审核')
suggestEmbed=discord.Embed(颜色=0x28da5b)
suggestEmbed=discord.Embed(title=“Suggestbot”,description=“请标记✅ 或❌ 取决于您是否接受此建议”,color=0x28da5b)
message=wait channel.send(嵌入=suggestEmbed)
等待消息。添加反应('✅')
等待消息。添加反应('❌')
sendEmbed=discord.Embed(颜色=0x28da5b)
添加_字段(名称='New Suggestion!',值=f'{Suggestion}')
def检查(反应、用户):
返回的不是user.bot和message==reaction.message
尝试:
反应,用户=等待机器人。等待('reaction\u add',check=check)
而reaction.message==消息:
如果str(reaction.emoji)=”✅":

等待ctx.send(“谢谢,它已经起作用了。我可以再问你一个问题吗?如果我输入多个建议,我只能对其中一个作出反应。有没有办法对这两个建议都作出反应?我尝试删除了“返回”但是它从未停止发送它,所以我必须在您的支票中输入return以终止进程,添加
和message==reaction.message
,我将编辑答案