Last active
December 18, 2023 21:41
-
-
Save exitcas/85c8f0d3bf66337dd571278755de180b to your computer and use it in GitHub Desktop.
Cool template for using Cogs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import discord | |
from discord.ext import commands | |
# Under the Unlicense <unlicense.org> | |
# Made by exitcas | |
TOKEN = "<token>" | |
PREFIX = "<prefix>" | |
DESCRIPTION = "<description>" | |
COGS_DIR = "cogs" | |
intents = discord.Intents( | |
emojis_and_stickers = True, | |
guild_reactions = True, | |
members = True, | |
message_content = True, | |
messages = True, | |
invites = True | |
) | |
bot = commands.Bot( | |
command_prefix = PREFIX, | |
description = "<description>", | |
allowed_mentions = discord.AllowedMentions( | |
roles = True, | |
users = True, | |
everyone = False | |
), | |
intents = intents | |
) | |
cog = str() | |
split_cog = list() | |
@bot.event | |
async def setup_hook(): | |
for x in os.listdir(COGS_DIR + "/"): | |
if x.endswith(".py"): | |
split_cog = x.split(".") | |
split_cog.pop(len(split_cog) - 1) | |
cog = ".".join(split_cog) | |
await bot.load_extension(COGS_DIR + "." + cog) | |
@bot.event | |
async def on_ready(): | |
await bot.tree.sync() | |
if __name__ == "__main__": | |
bot.run(TOKEN) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment