fix(token): fix all possible flaw of leaked token
This commit is contained in:
parent
caa98c44f4
commit
96618fa502
2 changed files with 25 additions and 6 deletions
utils/functions
|
@ -1,20 +1,35 @@
|
|||
from discord.ext import commands
|
||||
from utils import Config
|
||||
|
||||
|
||||
class commandsPlus(commands.Command):
|
||||
class CommandsPlus(commands.Command):
|
||||
def __init__(self, func, **kwargs):
|
||||
super().__init__(func, **kwargs)
|
||||
self.category = kwargs.get("category", 'other')
|
||||
|
||||
|
||||
def commandExtra(*args, **kwargs):
|
||||
return commands.command(*args, **kwargs, cls=commandsPlus)
|
||||
|
||||
|
||||
class GroupPlus(commands.Group):
|
||||
def __init__(self, func, **kwargs):
|
||||
super().__init__(func, **kwargs)
|
||||
self.category = kwargs.get("category", 'other')
|
||||
|
||||
|
||||
class ContextPlus(commands.Context):
|
||||
async def send(self, **kwargs):
|
||||
config = Config('./configs/config.cfg')
|
||||
content = kwargs.pop('content')
|
||||
|
||||
content = content.replace(config.get("bot", "Token"), 'Whoops! leaked token')
|
||||
content = content.replace(config.get("webhook", "Token"), 'Whoops! leaked token')
|
||||
|
||||
kwargs['content'] = content
|
||||
|
||||
return await super().send(**kwargs)
|
||||
|
||||
|
||||
def commandExtra(*args, **kwargs):
|
||||
return commands.command(*args, **kwargs, cls=CommandsPlus)
|
||||
|
||||
|
||||
def groupExtra(*args, **kwargs):
|
||||
return commands.group(*args, **kwargs, cls=GroupPlus)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue