0

My code is run bot is online.But command can't

import discord
from discord.ext import commands

client = commands.Bot(command_prefix=".")

@client.event
async def on_ready():
     print('Logged in as {0.user}'.format(client))

@client.command(description='ping')
async def ping(ctx):
     await ctx.send(f'{round(client.latency*1000)}ms')

client.run(!@#$$%)
Hasan Haghniya
  • 2,347
  • 4
  • 19
  • 29

1 Answers1

-1

First of all, a prefixed command cannot have a description inside the command decorator... If you want it to have one in the Help Command do something like this:

@client.command()
async def ping(ctx):
  """Shows the current latency of the bot"""

Then, could you post the error message if raised?

Anyways, try using this:

@client.command()
async def ping(ctx):
  """Shows the current latency of the bot"""
  await ctx.typing()
  ping = client.latency*1000
  embed = discord.Embed(title=" || ¡Pong!", description="Latency:\n{}ms".format(ping), color=ctx.author.color)
  await ctx.reply(embed=embed)

Any other thing that you dont understand, isnt clear, etc. tell to me via comments, ill edit my answer as fast as possible