【发布时间】:2021-06-04 11:26:26
【问题描述】:
covid = Covid()
covid.get_data()
confirmed = covid.get_total_confirmed_cases()
active = covid.get_total_active_cases()
recovered = covid.get_total_recovered()
deaths = covid.get_total_deaths()
@bot.group(invoke_without_command=True)
async def covid(ctx):
em = discord.Embed(title = "Covid-19", description = "test", color = ctx.author.color)
em.add_field(name = "test2", value = active)#
em.add_field(name = "test3", value = confirmed)
em.add_field(name = "test4", value = deaths)
em.add_field(name = "test5", value = recovered)
await ctx.send(embed = em)
")
bot启动时,从库中接收当前数据,发送消息时,发送消息,只接收一次,启动后不再更新此数据,我需要确保即使机器人正在运行,数据也会更新和发送
【问题讨论】:
标签: python python-3.x discord discord.py