Main Example

You can create your bot by using the ezcord.Bot class.

Hint

If you are using Pycord with Prefix commands, use ezcord.PrefixBot instead.

  • You can load all of your cogs at once with load_cogs().

  • If you pass in a webhook URL, errors will be sent to that webhook.

  • You can set the language for user messages, for example if an application command error occurs.

  • A custom on_ready message will be printed, unless you set ready_event=None.

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())