This commit is contained in:
rzmk 2021-05-18 18:49:47 -04:00
commit ff885642c5

View file

@ -1,7 +1,7 @@
import discord import discord
from discord.ext import commands from discord.ext import commands
class ExampleCog(commands.Cog): class PingCog(commands.Cog):
def __init__(self, client): def __init__(self, client):
self.client = client self.client = client
@ -12,9 +12,9 @@ class ExampleCog(commands.Cog):
print('Bot is online.') print('Bot is online.')
# Commands # Commands
@commands.command() @commands.command(aliases=['latency'])
async def ping(self, ctx): async def ping(self, ctx):
await ctx.send('Pong!') await ctx.send(f'Pong! {round(client.latency * 1000)}ms')
def setup(client): def setup(client):
client.add_cog(ExampleCog(client)) client.add_cog(PingCog(client))