【发布时间】:2021-10-22 08:25:52
【问题描述】:
我目前正在开发一个不和谐的机器人,我做了一个创建投票的命令。现在我希望机器人计算反应并根据反应量编辑消息(如果有更多 ✅ 或更多 ❌ 反应)。我阅读了 API 参考和多个网站,但找不到任何对我有帮助的东西。
这是我使用的代码:
@commands.command(name="poll")
async def poll(self,ctx: commands.Context,arg1, arg2):
arg3 = int(arg2)/3600
embed = discord.Embed(title="NEW POLL", description=f"{arg1} \nPoll lasts for: {round(arg3, 2)}h")
embed2 = discord.Embed(title="POLL OVER", description="The answer is `yes`(✅)!")
embed3 = discord.Embed(title="POLL OVER", description="The answer is `no` (❌)!")
embed4 = discord.Embed(title="POLL OVER", description="It's a tie!")
message = await ctx.send(embed=embed)
await message.add_reaction("✅")
await message.add_reaction("❌")
time.sleep(int(arg2))
【问题讨论】:
标签: python pip discord discord.py