forked from OWASP/Nest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
271 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Slack bot community command.""" | ||
|
||
from django.conf import settings | ||
|
||
from apps.common.constants import NL | ||
from apps.slack.apps import SlackConfig | ||
from apps.slack.blocks import markdown | ||
|
||
COMMAND = "/community" | ||
|
||
|
||
def community_handler(ack, command, client): | ||
"""Slack /community command handler.""" | ||
ack() | ||
|
||
if not settings.SLACK_COMMANDS_ENABLED: | ||
return | ||
|
||
blocks = [ | ||
markdown( | ||
f"Please visit <https://nest.owasp.dev/community/users/|OWASP community> page{NL}" | ||
), | ||
] | ||
|
||
conversation = client.conversations_open(users=command["user_id"]) | ||
client.chat_postMessage(channel=conversation["channel"]["id"], blocks=blocks) | ||
|
||
|
||
if SlackConfig.app: | ||
community_handler = SlackConfig.app.command(COMMAND)(community_handler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""Slack bot users command.""" | ||
|
||
from django.conf import settings | ||
|
||
from apps.common.constants import NL | ||
from apps.slack.apps import SlackConfig | ||
from apps.slack.blocks import markdown | ||
|
||
COMMAND = "/users" | ||
|
||
|
||
def users_handler(ack, command, client): | ||
"""Slack /users command handler.""" | ||
ack() | ||
|
||
if not settings.SLACK_COMMANDS_ENABLED: | ||
return | ||
|
||
blocks = [ | ||
markdown(f"Please visit <https://nest.owasp.dev/users/users/|OWASP users> page{NL}"), | ||
] | ||
|
||
conversation = client.conversations_open(users=command["user_id"]) | ||
client.chat_postMessage(channel=conversation["channel"]["id"], blocks=blocks) | ||
|
||
|
||
if SlackConfig.app: | ||
users_handler = SlackConfig.app.command(COMMAND)(users_handler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.