diff --git a/commands.py b/commands.py index 08ed3c0..c757a93 100644 --- a/commands.py +++ b/commands.py @@ -120,7 +120,7 @@ async def info_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No "Date:", HtmlFormat.hyperlink( created_at.strftime("%Y-%m-%d %X (%z)"), - f"{config.app.protocol}://{config.app.hostname}/posts?tags=date:{created_at.strftime("%Y-%m-%d")}", + f"{config.app.protocol}://{config.app.hostname}/posts?tags=date:{created_at.strftime('%Y-%m-%d')}", ), ] ) @@ -295,7 +295,7 @@ async def user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No vote_post_count, f"{config.app.protocol}://{config.app.hostname}/post_votes?search[user_name]={user_data['name']}", ), - f"({' '.join([ + f"""({' '.join([ HtmlFormat.hyperlink( f"up:{upvote_post_count}", f"{config.app.protocol}://{config.app.hostname}/post_votes?search[user_name]={user_data['name']}&search[score]=1", @@ -304,7 +304,7 @@ async def user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No f"down:{downvote_post_count}", f"{config.app.protocol}://{config.app.hostname}/post_votes?search[user_name]={user_data['name']}&search[score]=-1", ), - ])})", + ])})""", ] ) ) @@ -438,7 +438,7 @@ async def user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No total_feedback_count, f"{config.app.protocol}://{config.app.hostname}/user_feedbacks?search[user_name]={user_data['name']}", ), - f"({' '.join([ + f"""({' '.join([ HtmlFormat.hyperlink( f"positive:{user_data['positive_feedback_count']}", f"{config.app.protocol}://{config.app.hostname}/user_feedbacks?search[user_name]={user_data['name']}&search[category]=positive", @@ -451,7 +451,7 @@ async def user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No f"negative:{user_data['negative_feedback_count']}", f"{config.app.protocol}://{config.app.hostname}/user_feedbacks?search[user_name]={user_data['name']}&search[category]=negative", ), - ])})" + ])})""" ] ) ) diff --git a/config.py b/config.py index 4c5d2f1..b165558 100644 --- a/config.py +++ b/config.py @@ -11,7 +11,7 @@ _c.optionxform = str def init_config() -> None: - if _validate_config() is False: + if not _validate_config(): print("Config is invalid.") exit(1) _c.read("config.ini", "utf-8") @@ -58,7 +58,7 @@ def _validate_config() -> bool: try: response = requests.get( - f"http://{_c.get("App", "Host")}/status.json", timeout=10 + f"http://{_c.get('App', 'Host')}/status.json", timeout=10 ) if response.status_code != 200: raise requests.exceptions.InvalidURL