未识别延迟

Latency is not identified

我今天正在测试我的代码,突然出现错误,说他们无法在_ _ init.py _ _ 中找到延迟参考。这以前从未发生过,所以我不知道该怎么办。这是命令和导入的代码:

import discord
from discord.ext import commands
from pretty_help import PrettyHelp


bot = commands.Bot(command_prefix=".")
bot.load_extension('cog_admin')
bot.load_extension('cog_stuff')
bot.load_extension('cog_info')
bot.help_command = PrettyHelp()


bot.help_command = PrettyHelp(index_title="CatsyBot Help Page", no_category="Stuff")


@commands.command()
async def ping(ctx):
    """PING PONG"""
    await ctx.send(f" Pong with {str(round(commands.latency, 2))}")

commands 没有属性 latency,但是您的 bot 实例有

await ctx.send(f" Pong with {str(round(bot.latency, 2))}")