1from discord.ext import commands
2
3class Test_Cog(commands.Cog):
4 def __init__(self, bot):
5 self.bot = bot # defining bot as global var in class
6
7 @commands.Cog.listener() # this is a decorator for events/listeners
8 async def on_ready(self):
9 print('Bot is ready!.')
10
11 @commands.command() # this is for making a command
12 async def ping(self, ctx):
13 await ctx.send(f'Pong! {round(self.bot.latency * 1000)}')
14
15def setup(bot): # a extension must have a setup function
16 bot.add_cog(Test_Cog(bot)) # adding a cog
1class Test(commands.cog):
2
3 def __init__(self, client):
4 self.client = client
5 self._last_member = None