From 01c3ae6d75fa60dd79a4671103c3375a0aac9efe Mon Sep 17 00:00:00 2001 From: Nathaniel Varona <194283+nathanielvarona@users.noreply.github.com> Date: Sun, 5 May 2024 01:16:25 +0800 Subject: [PATCH] Functions Return Types --- .../function/pritunl_slack_app/pritunl_slack.py | 11 +++++++---- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pritunl_slack_app/function/pritunl_slack_app/pritunl_slack.py b/pritunl_slack_app/function/pritunl_slack_app/pritunl_slack.py index f2dfdf6..cb9a283 100644 --- a/pritunl_slack_app/function/pritunl_slack_app/pritunl_slack.py +++ b/pritunl_slack_app/function/pritunl_slack_app/pritunl_slack.py @@ -33,11 +33,13 @@ @app.middleware def log_request(logger, body, next): + """Log incoming requests""" logger.debug(body) return next() -def validate_command(body): +def validate_command(body: dict) -> bool: + """Validate incoming command""" command_args = body.get("text") if command_args is None or len(command_args) == 0: return False @@ -52,7 +54,8 @@ def validate_command(body): return False -def initial_acknowledgement(body, ack): +def initial_acknowledgement(body: dict, ack): + """Send initial acknowledgement response""" def command_usage(): return str(f"*:book: Usage:* `{body['command']} profile-key [ORGANIZATION]`") @@ -61,8 +64,8 @@ def command_accepted(): ack(command_accepted() if validate_command(body) else command_usage()) - -def processing_request(respond, body): +def processing_request(respond, body: dict): + """Process incoming request""" if validate_command(body): respond(f"Hi <@{body['user_id']}>, please kindly wait while we process your request.") diff --git a/pyproject.toml b/pyproject.toml index 138a824..9468b23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pritunl-slack-app" -version = "0.1.9" +version = "0.1.10" description = "Pritunl Slack App Slash Commands" authors = ["Nathaniel Varona "] license = "MIT"