mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-02 15:32:04 +00:00
* quick econ fix * black * keys and feature flags * terminal name 👀 * some more replacements * some more replacements * edit pyproject * gst -> openbb * add example portfolios back to git * Update api from gst * sorry. skipping some tests * another round of names * another round of test edits * Missed some .gst refs and update timezone * water mark stuff * Fixing Names in terminal.spec and name of GTFF_DEFAULTS to OBBFF_DEFAULTS * fix more GST to OpenBB Terminal * Logging : merge conflicts with main * Revert wrong files Co-authored-by: Andrew <andrew.kenreich@gmail.com> Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt> Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
import logging
|
|
import os
|
|
|
|
from dotenv import load_dotenv
|
|
from slack_bolt import App
|
|
from slack_bolt.adapter.socket_mode import SocketModeHandler
|
|
|
|
from bots.common.commands_dict import commands
|
|
from bots.common.helpers import non_slash
|
|
from bots.helpers import ShowView
|
|
|
|
load_dotenv()
|
|
|
|
app = App(token=os.environ["OPENBB_SLACK_APP_TOKEN"])
|
|
|
|
available_commands = list(commands.keys())
|
|
|
|
|
|
@app.event("message")
|
|
def processMessage(event, client):
|
|
"""Process users' commands"""
|
|
channel_id = event.get("channel")
|
|
user_id = event.get("user")
|
|
text = event.get("text")
|
|
non_slash(
|
|
text,
|
|
lambda x: client.chat_postMessage(
|
|
**{"channel": channel_id, "username": user_id, "text": x}
|
|
),
|
|
lambda x, y, z: ShowView().slack(x, channel_id, user_id, client, y, **z),
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# TODO: replace with GST logging
|
|
logger = logging.getLogger()
|
|
logger.setLevel(logging.DEBUG)
|
|
logger.addHandler(logging.StreamHandler())
|
|
handler = SocketModeHandler(
|
|
app,
|
|
os.environ["OPENBB_SLACK_BOT_TOKEN"],
|
|
)
|
|
handler.start()
|