2019-12-16 19:36:55 +01:00
|
|
|
from discord.ext import commands
|
2020-01-15 22:56:54 +01:00
|
|
|
from utils.functions import Config
|
2019-12-16 19:36:55 +01:00
|
|
|
|
|
|
|
|
2020-01-15 21:40:12 +01:00
|
|
|
class CommandsPlus(commands.Command):
|
2019-12-16 19:36:55 +01:00
|
|
|
def __init__(self, func, **kwargs):
|
|
|
|
super().__init__(func, **kwargs)
|
2019-12-17 22:41:54 +01:00
|
|
|
self.category = kwargs.get("category", 'other')
|
2019-12-16 19:36:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
class GroupPlus(commands.Group):
|
|
|
|
def __init__(self, func, **kwargs):
|
|
|
|
super().__init__(func, **kwargs)
|
2019-12-17 22:41:54 +01:00
|
|
|
self.category = kwargs.get("category", 'other')
|
2019-12-16 19:36:55 +01:00
|
|
|
|
2020-01-15 21:40:12 +01:00
|
|
|
|
|
|
|
class ContextPlus(commands.Context):
|
2020-02-04 18:47:11 +01:00
|
|
|
async def send(self, content=None, **kwargs):
|
2020-01-15 21:40:12 +01:00
|
|
|
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 18:47:11 +01:00
|
|
|
return await super().send(content, **kwargs)
|
2020-01-15 21:40:12 +01:00
|
|
|
|
|
|
|
|
2020-02-04 18:47:11 +01:00
|
|
|
def command_extra(*args, **kwargs):
|
2020-01-15 21:40:12 +01:00
|
|
|
return commands.command(*args, **kwargs, cls=CommandsPlus)
|
|
|
|
|
|
|
|
|
2020-02-04 18:47:11 +01:00
|
|
|
def group_extra(*args, **kwargs):
|
2019-12-16 19:36:55 +01:00
|
|
|
return commands.group(*args, **kwargs, cls=GroupPlus)
|