Loading repository dataβ¦
Loading repository dataβ¦
philosolog / repository
π My personal Discord bot template written in Python w/ Pycord.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
My personal, modern, and type-safe Discord bot template written in Python with Pycord.
.env supportInstall dependencies:
uv sync
Configure environment variables:
.env.example to .env.env and add your Discord bot token:
token=YOUR_BOT_TOKEN_HERE
uid=YOUR_BOT_ID_HERE
Run the bot:
uv run python main.py
Pycord-Template/
βββ cogs/ # Bot command modules (cogs)
β βββ template.py # Example cog
βββ main.py # Bot entry point
βββ settings.py # Configuration management
βββ pyproject.toml # Project metadata and dependencies
βββ .env # Environment variables (create from .env.example)
βββ .env.example # Example environment variables
Create a new file in the cogs/ directory:
"""Your cog description."""
import discord
from discord.ext import commands
class YourCog(commands.Cog):
"""Your cog class description."""
def __init__(self, bot: discord.Bot) -> None:
"""Initialize the cog."""
self.bot = bot
@discord.slash_command(
name="your_command",
description="Your command description",
)
async def your_command(self, ctx: discord.ApplicationContext) -> None:
"""Your command implementation."""
await ctx.respond("Hello!")
def setup(bot: discord.Bot) -> None:
"""Set up the cog."""
bot.add_cog(YourCog(bot))
Cogs are automatically loaded from the cogs/ directory when the bot starts.
For running a test bot alongside your main bot, you can add debug variables to your .env file.
The bot will use token_debug and uid_debug if they exist, otherwise it falls back to token and uid. Simply comment out or remove the debug variables to switch back to your production bot.