Skip to content

Commit

Permalink
version 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Feb 11, 2021
1 parent c8ce291 commit 15b729d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
40 changes: 40 additions & 0 deletions examples/socket_mode_proxy.py
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()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
exclude=["examples", "integration_tests", "tests", "tests.*",]
),
include_package_data=True, # MANIFEST.in
install_requires=["slack_sdk>=3.3.1,<3.4",],
install_requires=["slack_sdk>=3.3.2,<3.4",],
setup_requires=["pytest-runner==5.2"],
tests_require=test_dependencies,
test_suite="tests",
Expand Down
4 changes: 3 additions & 1 deletion slack_bolt/adapter/socket_mode/builtin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from logging import Logger
from time import time
from typing import Optional
from typing import Optional, Dict

from slack_sdk import WebClient
from slack_sdk.socket_mode.request import SocketModeRequest
Expand All @@ -25,6 +25,7 @@ def __init__( # type: ignore
logger: Optional[Logger] = None,
web_client: Optional[WebClient] = None,
proxy: Optional[str] = None,
proxy_headers: Optional[Dict[str, str]] = None,
auto_reconnect_enabled: bool = True,
trace_enabled: bool = False,
all_message_trace_enabled: bool = False,
Expand All @@ -40,6 +41,7 @@ def __init__( # type: ignore
logger=logger if logger is not None else app.logger,
web_client=web_client if web_client is not None else app.client,
proxy=proxy if proxy is not None else app.client.proxy,
proxy_headers=proxy_headers,
auto_reconnect_enabled=auto_reconnect_enabled,
trace_enabled=trace_enabled,
all_message_trace_enabled=all_message_trace_enabled,
Expand Down
2 changes: 1 addition & 1 deletion slack_bolt/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.1"
__version__ = "1.3.2"

0 comments on commit 15b729d

Please sign in to comment.