Files
OpenBB/bots/groupme/run_groupme.py
teh_coderer a36da387e2 fixes/tbl-columns-width/refactor (#1527)
* 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>
2022-03-21 11:54:19 -04:00

31 lines
723 B
Python

import json
from bots.common.helpers import non_slash
from bots.groupme.groupme_helpers import send_message
from bots.helpers import ShowView
def handle_groupme(request) -> bool:
"""Handles groupme bot inputs
Parameters
----------
request : Request
The request object provided by FASTAPI
Returns
----------
success : bool
Whether the response was sent successfully
"""
req = json.loads(request.decode("utf-8"))
text = req.get("text").strip()
group_id = req.get("group_id").strip()
response = non_slash(
text,
lambda x: send_message(x, group_id),
lambda x, y, z: ShowView().groupme(x, group_id, y, **z),
)
return response