generated from marcieltorres/python-boilerplate-project
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improving main structure using ideas from bolt-python-starter-template (
#11)
- Loading branch information
1 parent
8587377
commit 1f6202c
Showing
3 changed files
with
27 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from logging import getLogger | ||
|
||
from slack_bolt import App | ||
|
||
from src.messages.constants import DEFAULT_WARNING_MESSAGE | ||
from src.rules.pattern import pattern | ||
|
||
logger = getLogger(__name__) | ||
|
||
|
||
async def register(app: App): | ||
app.message(pattern.compiled_pattern)(regex_message_callback) | ||
|
||
|
||
async def regex_message_callback(message, say): | ||
try: | ||
user = message['user'] | ||
await say(text=DEFAULT_WARNING_MESSAGE.format(name=f'<@{user}>'), thread_ts=message.get('ts')) | ||
except Exception as e: | ||
logger.error(e) |
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,5 @@ | ||
from src.listeners.messages.regex_message import register as register_regex_message | ||
|
||
|
||
async def register_listeners(app): | ||
await register_regex_message(app) |