tuxbot-bot/utils/functions/extra.py

33 lines
980 B
Python
Raw Normal View History

from discord.ext import commands
from utils.functions import Config
class CommandsPlus(commands.Command):
def __init__(self, func, **kwargs):
super().__init__(func, **kwargs)
self.category = kwargs.get("category", 'other')
class GroupPlus(commands.Group):
def __init__(self, func, **kwargs):
super().__init__(func, **kwargs)
self.category = kwargs.get("category", 'other')
class ContextPlus(commands.Context):
2020-02-04 17:47:11 +00:00
async def send(self, content=None, **kwargs):
config = Config('./configs/config.cfg')
content = content.replace(config.get("bot", "Token"), 'Whoops! leaked token')
content = content.replace(config.get("webhook", "Token"), 'Whoops! leaked token')
2020-02-04 17:47:11 +00:00
return await super().send(content, **kwargs)
2020-02-04 17:47:11 +00:00
def command_extra(*args, **kwargs):
return commands.command(*args, **kwargs, cls=CommandsPlus)
2020-02-04 17:47:11 +00:00
def group_extra(*args, **kwargs):
return commands.group(*args, **kwargs, cls=GroupPlus)