discord .py cogs what they are and how to use them code example
Example 1: discord.py cog
from discord.ext import commands
class Ping(commands.Cog):
"""Receives ping commands"""
@commands.command()
async def ping(self, ctx: commands.Context):
await ctx.send("Pong")
def setup(bot: commands.Bot):
bot.add_cog(Ping())
Example 2: get cogs discord.py
ListOfCogs = client.cogs # this is a dictionary!
print(len(ListOfCogs))
for NameOfCog,TheClassOfCog in ListOfCogs.items(): # we can loop trough it!
print(NameOfCog)