diff --git a/src/main.py b/src/main.py index 01aa41e..4c43ae4 100644 --- a/src/main.py +++ b/src/main.py @@ -49,6 +49,7 @@ async def on_ready(self): @tree.command(name="fd", description="Frame data from a character move", guild=discord.Object("645011181739835397")) async def self(interaction: discord.Interaction, character_name: str, move: str): original_character_name = character_name + original_move = move character_name = util.correct_character_name(character_name.lower()) if character_name: character = util.get_character_by_name(character_name, character_list) @@ -65,7 +66,7 @@ async def self(interaction: discord.Interaction, character_name: str, move: str) move_embed = embed.move_embed(character, character_move) await interaction.response.send_message(embed=move_embed, ephemeral=False) else: - similar_moves = json_movelist_reader.get_similar_moves(character_move,move_list) + similar_moves = json_movelist_reader.get_similar_moves(original_move,move_list) similar_moves_embed = embed.similar_moves_embed(similar_moves,character_name) await interaction.response.send_message(embed=similar_moves_embed, ephemeral=False) else: diff --git a/src/module/json_movelist_reader.py b/src/module/json_movelist_reader.py index 9e00c3e..3a06861 100644 --- a/src/module/json_movelist_reader.py +++ b/src/module/json_movelist_reader.py @@ -104,13 +104,13 @@ def _get_close_matches_indexes(word, possibilities, n=3, cutoff=0.6): # Strip scores for the best n matches return [x for score, x in result] -def get_similar_moves(move :str, move_list: dict) -> list[str]: +def get_similar_moves(input :str, move_list: dict) -> list[str]: command_list = [] - for move in move_list: - command_list.append(move["input"]) + for entry in move_list: + command_list.append(entry["input"]) - moves_indexes = _get_close_matches_indexes(_simplify_input(move["input"]), map(_simplify_input, command_list), 5, 0.7) + moves_indexes = _get_close_matches_indexes(_simplify_input(input), map(_simplify_input, command_list), 5, 0.7) result = [] for index in moves_indexes: