updated ping command

This commit is contained in:
SeaswimmerTheFsh 2023-06-19 19:01:43 -04:00
parent 53dfa9fa5b
commit 7a05632bf0

12
main.py
View file

@ -4,6 +4,7 @@ from dotenv import load_dotenv
import aiohttp import aiohttp
import revolt import revolt
from revolt.ext import commands from revolt.ext import commands
import time
load_dotenv() load_dotenv()
token = os.getenv('TOKEN') token = os.getenv('TOKEN')
@ -17,8 +18,15 @@ class Client(commands.CommandsClient):
@commands.command() @commands.command()
async def ping(self, ctx: commands.Context): async def ping(self, ctx: commands.Context):
# This command checks if the bot is running. # This command checks the bot's latency.
await ctx.send("Pong!") before = time.monotonic()
await ctx.send("🏓")
mrm_list = await ctx.channel.history(limit=1)
mrm = mrm_list[0]
ping = (time.monotonic() - before) * 1000
embeds = [revolt.SendableEmbed(title="🏓 Pong!", description=f"`\n{int(ping)} ms`", colour="#5d82d1")]
await mrm.edit(content=None, embeds=embeds)
print(f'Ping {int(ping)}ms')
@commands.command() @commands.command()
async def avatar(self, ctx: commands.Context, member: revolt.Member): async def avatar(self, ctx: commands.Context, member: revolt.Member):