diff --git a/src/module/button.py b/src/module/button.py index 6bb6c5d..20ae4bb 100644 --- a/src/module/button.py +++ b/src/module/button.py @@ -8,13 +8,11 @@ def __init__(self, actioned_channel): @discord.ui.button(label="👍", style=discord.ButtonStyle.green) async def done(self, interaction: discord.Interaction, button: discord.ui.Button): - done_message = "{} \nactioned by **{}** with 👍\n".format( interaction.message.content, interaction.user.name) await self.actioned_channel.send(content=done_message) await interaction.message.delete() - @discord.ui.button(label="👎", style=discord.ButtonStyle.red) async def cancel(self, interaction: discord.Interaction, button: discord.ui.Button): done_message = "{} \nactioned by **{}** with 👎\n".format( diff --git a/src/module/configurator.py b/src/module/configurator.py index 8cbdcf0..010eca5 100644 --- a/src/module/configurator.py +++ b/src/module/configurator.py @@ -1,22 +1,22 @@ import os, json + class Configurator: def __init__(self, config_path): self.config_path = config_path - def create_file_if_not_exist(self): + def _create_file_if_not_exist(self): if not os.path.exists(self.config_path): with open(self.config_path, "w"): pass def read_config(self) -> dict: - self.create_file_if_not_exist() + self._create_file_if_not_exist() with open(self.config_path) as config_json: config_data = json.load(config_json) return config_data def write_config(self, config_json): - self.create_file_if_not_exist() + self._create_file_if_not_exist() with open(self.config_path, "w") as outfile: json.dump(config_json, outfile, indent=4) - diff --git a/src/module/embed.py b/src/module/embed.py index d89b900..5735479 100644 --- a/src/module/embed.py +++ b/src/module/embed.py @@ -45,6 +45,7 @@ def error_embed(message): description=message) return embed + def success_embed(message): embed = discord.Embed(title='Success', colour=SUCCESS_COLOR, diff --git a/src/module/util.py b/src/module/util.py index 54cf2d4..741668f 100644 --- a/src/module/util.py +++ b/src/module/util.py @@ -19,16 +19,19 @@ def correct_character_name(alias: str): return None -def get_character_by_name(name :str, character_list :[]) -> character.Character: + +def get_character_by_name(name: str, character_list: []) -> character.Character: for character in character_list: if character.name == name: return character + def get_move_type(original_move: str): for k in const.MOVE_TYPES.keys(): if original_move.lower() in const.MOVE_TYPES[k]: return k + def is_user_blacklisted(user_id): if user_id in const.ID_BLACKLIST: return True @@ -61,6 +64,3 @@ def periodic_function(scheduler, interval, function, character_list_path: str): while True: scheduler.enter(interval, 1, function, (character_list_path,)) scheduler.run() - - - diff --git a/src/wavu/wavu_reader.py b/src/wavu/wavu_reader.py index c2c0b00..0f6472c 100644 --- a/src/wavu/wavu_reader.py +++ b/src/wavu/wavu_reader.py @@ -149,12 +149,14 @@ def _convert_json_movelist(move_list_json: list) -> List[Move]: move_list.append(move) return move_list + def _remove_html_tags(data): result = html.unescape(_normalize_data(data)) result = BeautifulSoup(result, features="lxml").get_text() result = result.replace("* \n", "* ") return result + def _normalize_hit_ch_input(entry: str) -> str: entry = _empty_value_if_none(entry) if "|" in entry: