From abac24dd1aebb50c3ebb839c65abcd5f2a3034e7 Mon Sep 17 00:00:00 2001 From: lnguy Date: Thu, 15 Feb 2024 19:49:39 +0100 Subject: [PATCH] Fix Devil Jin Import --- src/main.py | 20 +++++++++----------- src/module/embed.py | 4 +++- src/module/util.py | 2 +- src/resources/character_list.json | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main.py b/src/main.py index ab6dc3d..3752b97 100644 --- a/src/main.py +++ b/src/main.py @@ -123,16 +123,14 @@ async def self(interaction: discord.Interaction, message: str): await interaction.response.send_message(embed=result, ephemeral=False) -try: - character_list = util.create_json_movelists(CHARACTER_LIST_PATH) - scheduler = sched.scheduler(time.time, time.sleep) - # Repeat importing move list of all character from wavu.wiki once an hour - scheduler_thread = threading.Thread(target=util.periodic_function, - args=(scheduler, 3600, util.create_json_movelists, CHARACTER_LIST_PATH)) - scheduler_thread.start() - hei.run(discord_token) +character_list = util.create_json_movelists(CHARACTER_LIST_PATH) +scheduler = sched.scheduler(time.time, time.sleep) + +# Repeat importing move list of all character from wavu.wiki once an hour +scheduler_thread = threading.Thread(target=util.periodic_function, + args=(scheduler, 3600, util.create_json_movelists, CHARACTER_LIST_PATH)) +scheduler_thread.start() +hei.run(discord_token) + -except Exception as e: - time_now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") - logger.error(f'{time_now} \n Error: {e}') diff --git a/src/module/embed.py b/src/module/embed.py index 596f703..f52602f 100644 --- a/src/module/embed.py +++ b/src/module/embed.py @@ -56,10 +56,12 @@ def success_embed(message): def move_embed(character: character, move: dict): """Returns the embed message for character and move""" + move_id = move["id"].replace(" ","_") + url= f'{character.wavu_page}_movelist#{move_id}' embed = discord.Embed(title='**' + move['input'] + '**', colour=SUCCESS_COLOR, description=move['name'], - url=f'{character.wavu_page}_movelist#{move["id"]}', + url=url, ) embed.set_thumbnail(url=character.portrait[0]) diff --git a/src/module/util.py b/src/module/util.py index b7b6cb0..c5e10b4 100644 --- a/src/module/util.py +++ b/src/module/util.py @@ -22,7 +22,7 @@ def correct_character_name(alias: str): def get_character_by_name(name: str, character_list: []) -> character.Character: for character in character_list: - if character.name == name: + if str(character.name).lower() == name.lower(): return character diff --git a/src/resources/character_list.json b/src/resources/character_list.json index 7400ec2..22d7554 100644 --- a/src/resources/character_list.json +++ b/src/resources/character_list.json @@ -25,7 +25,7 @@ "wavu_page": "https://wavu.wiki/t/Claudio" }, { - "name": "devil_jin", + "name": "devil_Jin", "portrait": "https://i.imgur.com/Y0pez4V.png", "wavu_page": "https://wavu.wiki/t/Devil_Jin" },