23 lines
570 B
Python
23 lines
570 B
Python
# cmd_discord/ping.py
|
|
|
|
import discord
|
|
from discord.ext import commands
|
|
import cmd_common.common_commands as cc
|
|
|
|
class PingCog(commands.Cog):
|
|
"""Handles the '!ping' command."""
|
|
|
|
def __init__(self, bot):
|
|
self.bot = bot
|
|
|
|
@commands.command(name="ping")
|
|
async def cmd_ping_text(self, ctx):
|
|
"""Checks bot's uptime and latency."""
|
|
result = cc.ping()
|
|
latency = round(self.bot.latency * 1000)
|
|
result += f" (*latency: {latency}ms*)"
|
|
await ctx.reply(result)
|
|
|
|
async def setup(bot):
|
|
await bot.add_cog(PingCog(bot))
|