discord bot python cogs code example
Example: discord.py cogs example
import os
import discord
from discord.ext import commands
prefix = "?"
cogs_folder="./cogs"
bot = commands.Bot(command_prefix=prefix)
for file in cogs_folder:
if file.endswith(".py"):
try:
bot.load_extension(f"cogs.{file[:-3]}")
print(f"Loaded: {file}")
except:
print(f"Could not load: {file}")