Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TLNBS2405 committed Dec 20, 2023
1 parent 2878558 commit e3e47a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions src/module/json_movelist_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e3e47a2

Please sign in to comment.