Updated bot.py and pingCog.py
This commit is contained in:
parent
98de50e555
commit
b6ef2a7567
2 changed files with 10 additions and 7 deletions
7
bot.py
7
bot.py
|
|
@ -5,6 +5,13 @@ from discord.ext import commands
|
|||
TOKEN = os.environ.get("TOKEN")
|
||||
client = commands.Bot(command_prefix= 'd!')
|
||||
|
||||
@client.event
|
||||
async def on_ready():
|
||||
print(f'{client.user.name} is ready.')
|
||||
# print(f'Bot is in {len(client.guilds)} guilds.')
|
||||
# print(f'Guilds have {len(client.users)} members.')
|
||||
await client.change_presence(activity=discord.Streaming(name="Click the link!", url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"))
|
||||
|
||||
@client.command()
|
||||
async def load(ctx, extension):
|
||||
client.load_extension(f'cogs.{extension}')
|
||||
|
|
|
|||
|
|
@ -6,15 +6,11 @@ class PingCog(commands.Cog):
|
|||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
# Events
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self):
|
||||
print('Bot is online.')
|
||||
|
||||
# Commands
|
||||
@commands.command(aliases=['latency'])
|
||||
async def ping(self, ctx):
|
||||
await ctx.send(f'Pong! {client.latency}ms')
|
||||
|
||||
# await ctx.send(f'Pong! {client.latency}ms')
|
||||
await ctx.send('Pong!')
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(PingCog(client))
|
||||
Loading…
Add table
Add a link
Reference in a new issue