Answer the question
In order to leave comments, you need to log in
Error receiving bot ping?
import discord
from discord.ext import commands
from discord.ext.commands import bot
@commands.command()
async def тян (self, ctx):
embed = discord.Embed(
title = 'Кто я?',
description = 'Я не большой бот, зовут меня **Сузуки**, надеюсь запомните.\nКак и все боты в моём стиле я `Тянка`. Ладно что-то я отвлеклась.\n\nЧто я могу? Ну в принципе как все боты я имею команды, для:\n`Модерации`, `Веселья`, `Получения информации`.\n\nНу на этом пока всё. Мой `Семпай` трудится и делает меня \n`Лучше`, `Красивее` и `Продвинутой`.',
colour = 0x694c5f
)
ping = bot.latency * 1000
embed.add_field(name= 'Имя:', value= '`Сузуки`')
embed.add_field(name= 'Создатель:', value= '`Барабан4ик#3148`')
embed.add_field(name= 'Пинг:', value= f'`{ping} мс`')
embed.set_footer(text= 'Барабан4ик © 2021 Все права у тянок', icon_url= 'https://cdn.discordapp.com/avatars/637685929611493422/32b105aa2097b6a3a84b2cda2f7b8e00.png?size=128')
await ctx.reply(embed = embed)
Ignoring exception in command тян:
Traceback (most recent call last):
File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Baraban4ik\Desktop\Suzuki\cogs\info.py", line 19, in тян
ping = bot.latency * 1000
AttributeError: module 'discord.ext.commands.bot' has no attribute 'latency'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'discord.ext.commands.bot' has no attribute 'latency'
Answer the question
In order to leave comments, you need to log in
from discord.ext.commands import bot
What is this import and why do you need it? This is an internal bot module, not a bot object that you control and talk about in the docs.
import discord
from discord.ext import commands
intents = discord.Intents.default()
bot = commands.Bot(command_prefix='!', intents=intents)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question