在Discord.py中发送嵌入消息的顺序



我正在尝试制作一个欢迎机器人,它将发送第一条消息,当人们点击下面的按钮/表情符号时,下一条消息将会出现。将发布第一条消息,然后在下一条消息。现在我用so来启动它,你需要写test.

有什么建议吗?

@client.event
async def on_message(message):
if message.content == 'test':
how_channel = client.get_channel(CHANNELNAME)
myEmbed = discord.Embed(title="**Now then, how does everything work? Here's a quick tour!**", 
description="You can see your progression as a percentage as you progress, click the button below to continue trough!", 
color=0x00ff00)
myEmbed.add_field(name="It should only take a few minutes!", value="Press the button below to continue")
myEmbed.set_footer(text="Christer - How does it work", icon_url="https://cdn.icon-icons.com/icons2/2619/PNG/512/among_us_discord_icon_156922.png")

await how_channel.send(embed=myEmbed)

这是第一个被发送的消息,所以我希望下面的消息在按钮或表情符号被按下后发送。

@client.event
async def on_message(message):
if message.content == 'test':
how_channel = client.get_channel(CHANNELNAME)
myEmbed = discord.Embed(title="News Feed", 
description="The #announcements will be your most important channel here! You'll be able to keep up to date with everything which is happening within the server so you'll never miss a beat!", 
color=0x00ff00)
myEmbed.add_field(name="It should only take a few minutes!", value="Press the button below to continue")
myEmbed.set_footer(text="Christer - How does it work", icon_url="https://cdn.icon-icons.com/icons2/2619/PNG/512/among_us_discord_icon_156922.png")        
await how_channel.send(embed=myEmbed)

如果你想使用这些按钮,你需要指定你用来实现它们的库,这样我们才能帮助你。对于反应,您需要通过add_reaction (https://discordpy.readthedocs.io/en/stable/api.html#discord.Message.add_reaction)添加一个反应,然后使用wait_for (https://discordpy.readthedocs.io/en/stable/api.html#discord.Client.wait_for)将on_反动事件重定向到控件,就像您可能对消息所做的那样。别忘了在wait_for中设置一个check。

的例子:

message = await ctx.send(first_embed)
await message.add_reaction("🟢")
await client.wait_for('reaction_add', check = lambda reaction, user: user == message.author and str(reaction.emoji) == "🟢")
await ctx.send(second_embed)

最新更新