mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-31 22:41:19 +00:00
* few changes * import fix * missed removing test config * column order fix * import fix * removed df2img add new deps * req * update readme * add dep for image export, fix * get rid of yahoo-fin, add image export lib * import issues in some machines fix * images dir fix * init fix * fix? * test * test * Fixed text handling Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: DjangoServer <colin99delahunty@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["GT_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["GT_SLACK_BOT_TOKEN"],
|
|
)
|
|
handler.start()
|