Examples

Feel free to choose an example below. On this page, you can see an example for the main file.

Main Example

Pycord
import discord

import ezcord

bot = ezcord.Bot(
    intents=discord.Intents.default(),
    error_webhook_url="WEBHOOK_URL",  # Replace with your webhook URL
    language="de",
)

if __name__ == "__main__":
    bot.load_cogs("cogs")  # Load all cogs in the "cogs" folder
    bot.run("TOKEN")  # Replace with your bot token
Discord.py
import asyncio

import discord

import ezcord


class Bot(ezcord.Bot):
    def __init__(self):
        super().__init__(intents=discord.Intents.default())

    async def setup_hook(self):
        await super().setup_hook()
        await self.tree.sync()


async def main():
    async with Bot() as bot:
        bot.add_help_command()
        bot.load_cogs("cogs")  # Load all cogs in the "cogs" folder
        await bot.start("TOKEN")  # Replace with your bot token


if __name__ == "__main__":
    asyncio.run(main())