Skip to main content

An easy-to-use extension for Discord.py and Pycord

Project description

tdcord

An easy-to-use extension for Discord.py and Pycord with some utility functions.

Features

✏️ Reduce boilerplate code

  • Easy cog management
  • Embed templates
  • Datetime and file utilities
  • Wrapper for aiosqlite

✨ Error handling

  • Automatic error handling for slash commands
  • Error webhook reports
  • Custom logging

⚙️ Extensions

  • Help command - Automatically generate a help command for your bot
  • Status changer - Change the bot's status in an interval
  • Blacklist - Block users from using your bot

Installing

Python 3.9 or higher is required.

pip install tdcord

You can also install the latest version from GitHub. Note that this version may be unstable and requires git to be installed.

pip install git+https://github.com/tdius9/tdcord

If you need the latest version in your requirements.txt file, you can add this line:

tdcord @ git+https://github.com/tdius/tdcord

Useful Links

Examples

  • For more examples, see the example repository or the sample code.
  • Note: It's recommended to load the token from a .env file instead of hardcoding it. TdCord can automatically load the token if a TOKEN variable is present in the .env file.

Pycord

import tdcord
import discord

bot = tdcord.Bot(
    intents=discord.Intents.default()
)

if __name__ == "__main__":
    bot.load_cogs("cogs")  # Load all cogs in the "cogs" folder
    bot.run("TOKEN")

Discord.py

import asyncio
import discord
import tdcord


class Bot(tdcord.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")


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

Contributing

I am always happy to receive contributions. Here is how to do it:

  1. Fork this repository
  2. Make changes
  3. Create a pull request

You can also create an issue if you find any bugs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tdcord-0.1.2.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

tdcord-0.1.2-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

Details for the file tdcord-0.1.2.tar.gz.

File metadata

  • Download URL: tdcord-0.1.2.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for tdcord-0.1.2.tar.gz
Algorithm Hash digest
SHA256 11e17d94e0f923aecdcf0008eb16789dda9a3d7c1e11aea358027628d47fa6b0
MD5 c18b3892f57033bcb2bf7803f4e8e034
BLAKE2b-256 28e999c2fa75cd37823be2e0f78d455cd47cb91fc0510ea42d0b1e5537b4e077

See more details on using hashes here.

File details

Details for the file tdcord-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tdcord-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 47.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for tdcord-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 48c12891448d8189c57e6d9af40b21950a8801c3bc4371209f4f81a1751f3bd4
MD5 0db0ded5468a271beb8adfe3a2c7a71e
BLAKE2b-256 eebc95746f4cc7549d20ec6e52afae726183873e07eadbe7cc140abf3a57390b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page