Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TLNBS2405 committed Feb 1, 2024
1 parent da99641 commit 0dc0eaa
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/module/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions src/module/configurator.py
Original file line number Diff line number Diff line change
@@ -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)

1 change: 1 addition & 0 deletions src/module/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def error_embed(message):
description=message)
return embed


def success_embed(message):
embed = discord.Embed(title='Success',
colour=SUCCESS_COLOR,
Expand Down
8 changes: 4 additions & 4 deletions src/module/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()



2 changes: 2 additions & 0 deletions src/wavu/wavu_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0dc0eaa

Please sign in to comment.