当我使用disnake对我的不和谐的机器人进行编码时,当我使用/status而不是显示所有所需的信息时,正常运行时间会得到以下结果:<function status.<locals>.uptimed at 0x000001C35A56FE20>正在发生什么,以及如何解决它?
代码:
@bot.slash_command(description="Mostra a latência do bot", pass_context=True)
async def status(self, interaction: disnake.CommandInteraction):
await interaction.response.defer()
def uptimed():
pass
current_time = time.time()
difference = int(round(current_time - start_time))
text = str(datetime.timedelta(seconds=difference))
text.replace(" years", "Y")
text.replace(" year", "Y")
text.replace(" months", "M")
text.replace(" month", "M")
text.replace(" days", "d")
text.replace(" day", "d")
print(uptimed)
before = time.monotonic()
carregando = disnake.Embed(
description="⏳ - Carregando...",
color=0x00ffff
)
await interaction.edit_original_message(embed=carregando)
ping = (time.monotonic() - before) * 1000
Embed_De_Ping = disnake.Embed(
title="Status:",
description=f"> - Ping da Websocket: **{round(bot.latency * 1000)}**ms \n > - Ping da Client: **{int(ping)}**ms \n> - Uptime: **{uptimed}**",
color=0x2f3136)
await interaction.edit_original_message(embed=Embed_De_Ping)```发布于 2022-07-18 02:15:34
问题在于:
Embed_De_Ping = disnake.Embed(
title="Status:",
description=f"> - Ping da Websocket: **{round(bot.latency * 1000)}**ms \n > - Ping da Client: **{int(ping)}**ms \n> - Uptime: **{uptimed}**",
color=0x2f3136)更具体地说,这是:Uptime: **{uptimed}**"。uptimed是一个函数,您似乎忘记调用它了。应该是uptimed()。输出一个函数而不调用它只会打印它的内存地址。
https://stackoverflow.com/questions/71042216
复制相似问题