首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“<函数status.<locals>.uptimed at 0x000001C35A56FE20>",这是什么?

“<函数status.<locals>.uptimed at 0x000001C35A56FE20>",这是什么?
EN

Stack Overflow用户
提问于 2022-02-08 23:29:20
回答 1查看 43关注 0票数 0

当我使用disnake对我的不和谐的机器人进行编码时,当我使用/status而不是显示所有所需的信息时,正常运行时间会得到以下结果:<function status.<locals>.uptimed at 0x000001C35A56FE20>正在发生什么,以及如何解决它?

代码:

代码语言:javascript
复制
@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)```
EN

回答 1

Stack Overflow用户

发布于 2022-07-18 02:15:34

问题在于:

代码语言:javascript
复制
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()。输出一个函数而不调用它只会打印它的内存地址。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71042216

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档