⠀
This commit is contained in:
parent
be1e6d24e4
commit
cce7bb4093
13 changed files with 150 additions and 103 deletions
|
@ -15,21 +15,18 @@ class GroupPlus(commands.Group):
|
|||
|
||||
|
||||
class ContextPlus(commands.Context):
|
||||
async def send(self, **kwargs):
|
||||
async def send(self, content=None, **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)
|
||||
return await super().send(content, **kwargs)
|
||||
|
||||
|
||||
def commandExtra(*args, **kwargs):
|
||||
def command_extra(*args, **kwargs):
|
||||
return commands.command(*args, **kwargs, cls=CommandsPlus)
|
||||
|
||||
|
||||
def groupExtra(*args, **kwargs):
|
||||
def group_extra(*args, **kwargs):
|
||||
return commands.group(*args, **kwargs, cls=GroupPlus)
|
||||
|
|
|
@ -19,11 +19,16 @@ class Texts:
|
|||
self.locale = lang
|
||||
|
||||
@staticmethod
|
||||
def get_locale(ctx):
|
||||
with open('./configs/langs.json') as f:
|
||||
data = json.load(f)
|
||||
|
||||
def get_locale(ctx: commands.Context):
|
||||
lang = 'fr'
|
||||
if ctx is not None:
|
||||
return data.get(str(ctx.guild.id), data['default'])
|
||||
else:
|
||||
return data['default']
|
||||
try:
|
||||
with open(f'./configs/guilds/{ctx.guild.id}.json', 'r') as f:
|
||||
data = json.load(f)
|
||||
|
||||
lang = data['lang']
|
||||
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
return lang
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue