-
Notifications
You must be signed in to change notification settings - Fork 248
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
4 changed files
with
45 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# ------------------------------------------------ | ||
# instead of slack_bolt in requirements.txt | ||
import sys | ||
|
||
sys.path.insert(1, "..") | ||
# ------------------------------------------------ | ||
|
||
import logging | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
import os | ||
|
||
from slack_sdk import WebClient | ||
from slack_bolt import App | ||
from slack_bolt.adapter.socket_mode import SocketModeHandler | ||
|
||
# pip3 install proxy.py | ||
# proxy --port 9000 --log-level d | ||
proxy_url = "http://localhost:9000" | ||
|
||
# Install the Slack app and get xoxb- token in advance | ||
app = App( | ||
client=WebClient(token=os.environ["SLACK_BOT_TOKEN"], proxy=proxy_url) | ||
) | ||
|
||
|
||
@app.event("app_mention") | ||
def event_test(event, say): | ||
say(f"Hi there, <@{event['user']}>!") | ||
|
||
|
||
if __name__ == "__main__": | ||
# export SLACK_APP_TOKEN=xapp-*** | ||
# export SLACK_BOT_TOKEN=xoxb-*** | ||
SocketModeHandler( | ||
app=app, | ||
app_token=os.environ["SLACK_APP_TOKEN"], | ||
proxy=proxy_url, | ||
).start() |
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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "1.3.1" | ||
__version__ = "1.3.2" |