OokamiPupV2/cmd_discord/ping.py

22 lines
580 B
Python

# cmd_discord/howl.py
from discord.ext import commands
import cmd_common.common_commands as cc
def setup(bot):
"""
Registers the '!ping' command for Discord.
"""
@bot.command(name="ping")
async def cmd_ping_text(ctx):
"""
Check the bot's uptime and latency.
Usage:
- !ping
-> Returns the bot's uptime along with its latency in milliseconds.
"""
result = cc.ping()
latency = round(float(bot.latency) * 1000)
result += f" (*latency: {latency}ms*)"
await ctx.reply(result)