简体   繁体   English

discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:“Bot”object 没有属性“Latency”

[英]discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'Latency'

this is my code and every time i run it, is say discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'Latency'这是我的代码,每次我运行它时,都会说 discord.ext.commands.errors.CommandInvokeError: 命令引发异常:AttributeError: 'Bot' object 没有属性 'Latency'

import discord
from discord.ext import commands , tasks
from random import choice 
import json
import random
import os


intents = discord.Intents.all()
intents.message_content = True

client = commands.Bot(command_prefix = "+", intents=intents)




status = ["just programming","just chilling"]


@client.event
async def on_ready():
    change_status.start()
    print('log in successfully. {0.user} is online!'.format(client))


@client.command(name="ping", help="This is a ping command")
async def ping(ctx):
     await ctx.send(f"**Pong** Latency: {round(client.Latency * 1000)}ms")



@tasks.loop(seconds=20)
async def change_status():
     await client.change_presence(activity=discord.Game(choice(status)))

i tried every thing我尝试了一切

The variable you want to call is latency with a lowercase l, not an uppercase L.您要调用的变量是小写 l 的latency ,而不是大写 L。

await ctx.send(f"Latency: {round(client.latency * 1000)}ms")

Both Pycord and discord.py mention the casing of the variable and its usage in their documentation. Pycorddiscord.py在它们的文档中都提到了变量的大小写及其用法。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:'Command'对象没有属性'server' - discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'server' discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:'Command' object 没有属性'strftime' - discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'strftime' discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:'NoneType'对象没有属性'id' - discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id' discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:“NoneType”对象没有“提及”属性 - discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'mention' discord.ext.commands.errors.CommandInvokeError:命令引发了一个异常:AttributeError:'utility'对象没有属性'channel' - discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'utility' object has no attribute 'channel' discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:'str'对象没有属性'author' - discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'author' discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:'set' object 没有属性'get' - discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'set' object has no attribute 'get' discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:'NoneType' object 没有属性'qualified_name' - discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'qualified_name' discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:'ClientUser'对象没有属性'create_dm' - discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'ClientUser' object has no attribute 'create_dm' discord.ext.commands.errors.CommandInvokeError:命令引发异常:AttributeError:'Events' object 没有属性'get_channel - discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Events' object has no attribute 'get_channel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM