Answer the question
In order to leave comments, you need to log in
How to edit a bot message?
Hello, hello, I’m doing a command to issue a ping bot, but since the ping command in Windows has a long count, I decided to edit messages after counting, something like this: I
wrote such a simple code:
@bot.command()
async def ping(ctx):
emb = discord.Embed(description=f"Подсчет пинга...")
await ctx.send(embed=emb)
getBDping = os.system("ping айпи.сервера")
emb = discord.Embed(
description=f"""
**Пинг Сообщений**
``{round(bot.latency * 1000)}мс``\n
**Пинг Базы**
``{getBDping}мс``
""")
await ctx.message.edit(embed=emb)
Answer the question
In order to leave comments, you need to log in
Just take and edit the bot's message, not what is passed to you from the context.
@bot.command()
async def ping(ctx):
emb = discord.Embed(description=f"Подсчет пинга...")
msg = await ctx.send(embed=emb)
getBDping = os.system("ping айпи.сервера")
emb = discord.Embed(
description=f"""
**Пинг Сообщений**
``{round(bot.latency * 1000)}мс``\n
**Пинг Базы**
``{getBDping}мс``
""")
await msg.edit(embed=emb)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question