This commit is contained in:
Romain J 2021-04-20 15:51:03 +02:00
parent 1b7f153ec8
commit 7f9c202cc6
4 changed files with 11 additions and 3 deletions

View file

@ -6,7 +6,7 @@ def data_parser(data: str) -> dict:
"message": "", "message": "",
"compressed": False, "compressed": False,
"graphical": False, "graphical": False,
"chars": tuple(), "chars": tuple,
} }
if not data: if not data:

View file

@ -1,5 +1,4 @@
import asyncio import asyncio
import functools
import logging import logging
import time import time
from typing import Union from typing import Union

View file

@ -51,6 +51,7 @@ class ContextPlus(commands.Context):
e = embed.to_dict() e = embed.to_dict()
for key, value in e.items(): for key, value in e.items():
if isinstance(value, (str, bytes)): if isinstance(value, (str, bytes)):
# skipcq
e[key] = ( e[key] = (
value.replace( value.replace(
self.bot.config.Core.token, TOKEN_REPLACEMENT self.bot.config.Core.token, TOKEN_REPLACEMENT
@ -63,32 +64,40 @@ class ContextPlus(commands.Context):
.replace(self.bot.config.Core.ip6, IP_REPLACEMENT) .replace(self.bot.config.Core.ip6, IP_REPLACEMENT)
) )
elif isinstance(value, list): elif isinstance(value, list):
# skipcq
e[key] = replace_in_list( e[key] = replace_in_list(
value, self.bot.config.Core.token, TOKEN_REPLACEMENT value, self.bot.config.Core.token, TOKEN_REPLACEMENT
) )
# skipcq
e[key] = replace_in_list( e[key] = replace_in_list(
e[key], e[key],
self.bot.config.Core.Database.password, self.bot.config.Core.Database.password,
PASSWORD_REPLACEMENT, PASSWORD_REPLACEMENT,
) )
# skipcq
e[key] = replace_in_list( e[key] = replace_in_list(
e[key], self.bot.config.Core.ip, IP_REPLACEMENT e[key], self.bot.config.Core.ip, IP_REPLACEMENT
) )
# skipcq
e[key] = replace_in_list( e[key] = replace_in_list(
e[key], self.bot.config.Core.ip6, IP_REPLACEMENT e[key], self.bot.config.Core.ip6, IP_REPLACEMENT
) )
elif isinstance(value, dict): elif isinstance(value, dict):
# skipcq
e[key] = replace_in_dict( e[key] = replace_in_dict(
value, self.bot.config.Core.token, TOKEN_REPLACEMENT value, self.bot.config.Core.token, TOKEN_REPLACEMENT
) )
# skipcq
e[key] = replace_in_dict( e[key] = replace_in_dict(
e[key], e[key],
self.bot.config.Core.Database.password, self.bot.config.Core.Database.password,
PASSWORD_REPLACEMENT, PASSWORD_REPLACEMENT,
) )
# skipcq
e[key] = replace_in_dict( e[key] = replace_in_dict(
e[key], self.bot.config.Core.ip, IP_REPLACEMENT e[key], self.bot.config.Core.ip, IP_REPLACEMENT
) )
# skipcq
e[key] = replace_in_dict( e[key] = replace_in_dict(
e[key], self.bot.config.Core.ip6, IP_REPLACEMENT e[key], self.bot.config.Core.ip6, IP_REPLACEMENT
) )

View file

@ -199,7 +199,7 @@ def additional_config(cogs: Union[str, list] = "**"):
console.print(Rule(f"\nConfiguration for `{cog_name}` module")) console.print(Rule(f"\nConfiguration for `{cog_name}` module"))
mod = importlib.import_module(str(path).replace("/", ".")[:-3]) mod = importlib.import_module(str(path).replace("/", ".")[:-3])
mod_config_type = getattr(mod, cog_name.capitalize() + "Config") mod_config_type = getattr(mod, cog_name.capitalize() + "Config")
mod_extra = getattr(mod, "extra") mod_extra = mod.extra
mod_config = config.ConfigFile( mod_config = config.ConfigFile(
str(cogs_data_path(cog_name) / "config.yaml"), str(cogs_data_path(cog_name) / "config.yaml"),