Skip to content

Commit

Permalink
Fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
TLNBS2405 committed Feb 12, 2024
1 parent 32ebfda commit 11ec934
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,5 +342,5 @@ async def self(interaction: discord.Interaction, message: str):
hei.run(discord_token)

except Exception as e:
time_now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
time_now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
logger.error(f'{time_now} \n Error: {e}')
2 changes: 1 addition & 1 deletion src/module/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_json_movelists(character_list_path: str) -> List[character.Character]
cha = wavu_importer.import_character(character_meta)
cha.export_movelist_as_json()
cha_list.append(cha)
time_now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
time_now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f'{time_now} - Character jsons are successfully created')
return cha_list

Expand Down
2 changes: 1 addition & 1 deletion src/resources/character_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
{
"name": "xiaoyu",
"portrait": "https://i.imgur.com/tnZ4qby.png",
"wavu_page": "https://wavu.wiki/t/Yoshimitsu"
"wavu_page": "https://wavu.wiki/t/Xiaoyu"
},
{
"name": "yoshimitsu",
Expand Down
6 changes: 5 additions & 1 deletion src/wavu/wavu_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _convert_json_movelist(move_list_json: list) -> List[Move]:
if move["title"]["ns"] == "0":
alias = []
id = _normalize_data(move["title"]["id"])
name = _normalize_data(move["title"]["name"])
name = _normalize_data(_process_links(move["title"]["name"]))
input = _normalize_data(
_get_all_parent_values_of("input", _normalize_data(move["title"]["parent"]), move_list_json)
+ _normalize_data(move["title"]["input"]))
Expand Down Expand Up @@ -158,10 +158,14 @@ def _remove_html_tags(data):
result = result.replace("'''", "")
return result


link_replace_pattern = re.compile(r'\[\[(?P<page>[^#]+)#(?P<section>[^|]+)\|(?P<data>[^|]+)\]\]')


def _process_links(data: str | None) -> str:
def _replace_link(match):
page, section, data = match.group('page'), match.group('section'), match.group('data')
hover_text = 'Combo' if section == 'Staples' else 'Mini-combo'
return f"[{data}](https://wavu.wiki/t/{page.replace(' ', '_')}#{section} \'{hover_text}\')"

return link_replace_pattern.sub(_replace_link, _empty_value_if_none(data))

0 comments on commit 11ec934

Please sign in to comment.