All Projects β†’ chrisdewa β†’ dpytools

chrisdewa / dpytools

Licence: MIT license
Collection of easy to use, beginner friendly but powerful, orthogonal tools to speed up discord bots development (discord.py)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to dpytools

Best Of Python
πŸ† A ranked list of awesome Python open-source libraries and tools. Updated weekly.
Stars: ✭ 1,869 (+8026.09%)
Mutual labels:  utilities, pypi, utility-library
Craig S Utility Library
A giant set of utility classes originally start back in the .Net 2.0 days and updated until .Net Core and .Net Standard became a thing. At which point I took the library and broke it up into a ton of smaller libraries. View my profile for more up to date versions of everything.
Stars: ✭ 397 (+1626.09%)
Mutual labels:  utilities, utility-library
mogo
A collection of small DRY Go utilities to make life easier. DRY = Don't Repeat Yourself.
Stars: ✭ 19 (-17.39%)
Mutual labels:  utilities, utility-library
Utils
A collection of useful PHP functions, mini classes and snippets that you need and can use every day.
Stars: ✭ 750 (+3160.87%)
Mutual labels:  utilities, utility-library
CoreLibraries
A set of .NET libraries for building enterprise level solutions quickly
Stars: ✭ 22 (-4.35%)
Mutual labels:  utilities, utility-library
reactools
Create React interfaces is easy.
Stars: ✭ 14 (-39.13%)
Mutual labels:  utilities, helpers
Ubelt
A Python utility belt containing simple tools, a stdlib like feel, and extra batteries. Hashing, Caching, Timing, Progress, and more made easy!
Stars: ✭ 561 (+2339.13%)
Mutual labels:  utilities, utility-library
Biblioteca-DDR-Java
Funciones java con utilidades para distintos proyectos
Stars: ✭ 19 (-17.39%)
Mutual labels:  utilities, utility-library
Sequelize Test Helpers
A collection of utilities to help with unit-testing Sequelize models
Stars: ✭ 83 (+260.87%)
Mutual labels:  utilities, helpers
Alfonz
Mr. Alfonz is here to help you build your Android app, make the development process easier and avoid boilerplate code.
Stars: ✭ 90 (+291.3%)
Mutual labels:  utilities, helpers
utils
πŸ›  A collection of light-weight methods and helpers for defensive programming
Stars: ✭ 15 (-34.78%)
Mutual labels:  utilities, helpers
coding-bot-v4
A discord bot for The Coding Realm
Stars: ✭ 26 (+13.04%)
Mutual labels:  discord-py, discord-py-rewrite
diamonds
A pile of shiny typed JS helpers for everyday usage
Stars: ✭ 16 (-30.43%)
Mutual labels:  utilities, helpers-library
Dredd
A multipurpose Discord bot written in python language and enhanced discord.py library.
Stars: ✭ 105 (+356.52%)
Mutual labels:  discord-py, discord-py-rewrite
php-lodash
php-lodash is a PHP utility library, similar to Underscore/Lodash.
Stars: ✭ 35 (+52.17%)
Mutual labels:  utilities, helpers
Lodash Php
Easy to use utility functions for everyday PHP projects. This is a port of the Lodash JS library to PHP
Stars: ✭ 412 (+1691.3%)
Mutual labels:  utilities, utility-library
Yakutils
πŸƒ Yet another toolbox of Python 3 helper functions.
Stars: ✭ 111 (+382.61%)
Mutual labels:  pypi, helpers
table2ascii
Python library for converting lists to fancy ASCII tables for displaying in the terminal and on Discord
Stars: ✭ 31 (+34.78%)
Mutual labels:  utilities, discord-py
Sassyfication
πŸ’…Library with sass mixins to speed up your css workflow.
Stars: ✭ 51 (+121.74%)
Mutual labels:  utilities, utility-library
Utils
Ruby core extentions and class utilities for Hanami
Stars: ✭ 159 (+591.3%)
Mutual labels:  utilities, utility-library

forthebadge made-with-python

PyPI status PyPI version fury.io Downloads Documentation Status PyPI license

dpytools

Collection of easy to use, beginner friendly but powerful, orthogonal tools to speed up discord bots development (discord.py)

Features

  • The batteries of discord.py
  • Easy to read type-hinted code
  • Active development
  • Minimal dependencies

Instalation

Install the latest version of the library with pip.

pip install -U dpytools

Useful links:

Use Examples:

The library has a couple of reaction menus that are really easy to use. dpytools.menus.arrows takes a list of embeds and displays it using a reaction menu.

@bot.command()
async def arrow_menu(ctx):
    """
    This command sends a list of embeds in a reaction menu with emojis aid in navigation
    """
    from dpytools.menus import arrows
    long_list_of_embeds = [discord.Embed(...), ...]
    await arrows(ctx, long_list_of_embeds)

There are multiple checks you can use directly on your commands dpytools.checks.admin_or_roles takes any number of strings (Role names) and ints (role ID) and checks if the person using the command has those roles or has administrator permissions.

from dpytools.checks import admin_or_roles
@bot.command()
@admin_or_roles('Moderator', 123456789)
async def moderation(ctx):
    ctx.send('Only admins and people with a a role named "Moderator" ' 
             'or with a role with id 123456789 can use this command')
from dpytools.checks import any_checks

@commands.guild_only()       # This command must be called inside a server
@any_checks                  # Place the decorator above the checks you with to compare using "OR"
@commands.is_owner()         # The command will run if ctx.author is the owner of the bot
@commands.has_role('Admin')  # __OR__ if ctx.author has the role "Admin"
@bot.command()               # this decorator transforms this function in a command any_checks must be above it
async def test(ct):
    await ctx.send('The command works')

There are also multiple argument parsers. Functions that convert a user's input to something more useful. dpytools.parsers.to_timedelta takes a string in the format <number>[s|m|h|d|w] and returns a timedelta object

from dpytools.parsers import to_timedelta
@bot.command()
@commands.guild_only()
async def mute(ctx, member: discord.Member, time: to_timedelta):
    await ctx.send(f"{member.mention} muted for {time.total_seconds()} seconds")
    mute_role = ctx.guild.get_role(1234567890)
    await member.add_roles(mute_role)
    await asyncio.sleep(time.total_seconds())
    await member.remove_roles(mute_role)
    await ctx.send(f"{member.mention} unmuted")

This argument parsers can also be used outside the context of discord.ext.commands In the end most of them only take a string and return the appropriate object. Only converter classes that inherit from discord.ext.commands.Converter require a command context to work.

There are many other tools available in the library, check them in docs/All.md

Todos:

  1. Add interactions

Status of the project

Beta. All functions have been tested but new tools are frequently added. Breaking changes may come depending on changes on API or discord. Use in production only after extensive testing.

Contributing

Feel free to make a pull request or rise any issues.

Contact

Message me on discord at ChrisDewa#4552 if you have any questions, ideas or suggestions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].