【发布时间】:2021-10-06 07:13:31
【问题描述】:
我正在为我的 discord 机器人创建一个投票命令。我使用表情符号为投票选项投票。
我希望我的机器人在一段时间后显示投票结果(我还没有实现超时)。但要做到这一点,我需要计算每个表情符号。有办法吗?
到目前为止我的代码:
@bot.command(name='poll')
async def poll(ctx, question, option1 = None, option2 = None):
if option1 == None and option2 == None:
embed = discord.Embed(
title="Poll",
description=f"{question}",
color = discord.Color.blue()
)
msg = await ctx.channel.send(embed=embed)
message = await ctx.channel.fetch_message(msg.id)
await message.add_reaction("????")
await message.add_reaction("????")
embed = discord.Embed(
title="Poll",
description=f"{question}",
color=discord.Color.blue()
)
embed.add_field(name=f"{option1}", inline=False)
embed.add_field(name=f"{option2}", inline=False)
msg = await ctx.channel.send(embed=embed)
message = await ctx.channel.fetch_message(msg.id)
await message.add_reaction("????")
await message.add_reaction("????")
【问题讨论】:
标签: python python-3.x discord discord.py