<reponame>misscoded/bolt-python
# ------------------------------------------------
# instead of slack_bolt in requirements.txt
import sys

sys.path.insert(1, "../../src")
# ------------------------------------------------

import logging
from slack_bolt import App
from slack_bolt.adapter.bottle import SlackRequestHandler

logging.basicConfig(level=logging.DEBUG)
app = App()


@app.middleware  # or app.use(log_request)
def log_request(logger, payload, next):
    logger.debug(payload)
    return next()


@app.event("app_mention")
def event_test(ack, payload, say, logger):
    logger.info(payload)
    say("What's up?")


from bottle import get, post, request, response, run

handler = SlackRequestHandler(app)


@post("/slack/events")
def slack_events():
    return handler.handle(request, response)


@get("/slack/install")
def install():
    return handler.handle(request, response)


@get("/slack/oauth_redirect")
def oauth_redirect():
    return handler.handle(request, response)


if __name__ == "__main__":
    run(host="0.0.0.0", port=3000, reloader=True)

# pip install -r requirements.txt

# # -- OAuth flow -- #
# export SLACK_SIGNING_SECRET=***
# export SLACK_BOT_TOKEN=<KEY>
# export SLACK_CLIENT_ID=111.111
# export SLACK_CLIENT_SECRET=***
# export SLACK_SCOPES=app_mentions:read,chat:write

# FLASK_APP=oauth_app.py FLASK_ENV=development flask run -p 3000

# ------------------------------------------------
# instead of slack_bolt in requirements.txt
import sys

sys.path.insert(1, "../../src")
# ------------------------------------------------

import logging
from slack_bolt import App
from slack_bolt.adapter.bottle import SlackRequestHandler

logging.basicConfig(level=logging.DEBUG)
app = App()


@app.middleware  # or app.use(log_request)
def log_request(logger, payload, next):
    logger.debug(payload)
    return next()


@app.event("app_mention")
def event_test(ack, payload, say, logger):
    logger.info(payload)
    say("What's up?")


from bottle import get, post, request, response, run

handler = SlackRequestHandler(app)


@post("/slack/events")
def slack_events():
    return handler.handle(request, response)


@get("/slack/install")
def install():
    return handler.handle(request, response)


@get("/slack/oauth_redirect")
def oauth_redirect():
    return handler.handle(request, response)


if __name__ == "__main__":
    run(host="0.0.0.0", port=3000, reloader=True)

# pip install -r requirements.txt

# # -- OAuth flow -- #
# export SLACK_SIGNING_SECRET=***
# export SLACK_BOT_TOKEN=<KEY>
# export SLACK_CLIENT_ID=111.111
# export SLACK_CLIENT_SECRET=***
# export SLACK_SCOPES=app_mentions:read,chat:write

# FLASK_APP=oauth_app.py FLASK_ENV=development flask run -p 3000
# ------------------------------------------------ # instead of slack_bolt in requirements.txt # ------------------------------------------------ # or app.use(log_request) # pip install -r requirements.txt # # -- OAuth flow -- # # export SLACK_SIGNING_SECRET=*** # export SLACK_BOT_TOKEN=<KEY> # export SLACK_CLIENT_ID=111.111 # export SLACK_CLIENT_SECRET=*** # export SLACK_SCOPES=app_mentions:read,chat:write # FLASK_APP=oauth_app.py FLASK_ENV=development flask run -p 3000