Skip to content

Commit

Permalink
Merge pull request #23 from nathanielvarona/chore/functions-return-types
Browse files Browse the repository at this point in the history
Functions Return Types
  • Loading branch information
nathanielvarona authored May 4, 2024
2 parents b7f1f01 + 01c3ae6 commit 2590dea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions pritunl_slack_app/function/pritunl_slack_app/pritunl_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]`")

Expand All @@ -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.")

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <nathaniel.varona+pypi@gmail.com>"]
license = "MIT"
Expand Down

0 comments on commit 2590dea

Please sign in to comment.