Linking Telegram to HABot

I’ve just started playing with this so it’s a very preliminary work, inspired by Rhasspy to HABot

from core.actions import HTTP
import json

@rule("Telegram message")
@when("Item Telegram_Message received update")
def telegram_message(event): 
    url = "http://server:8484/rest/habot/chat"
    contenttype = "text/plain"
    request = event.itemState.toString()
    output = HTTP.sendHttpPostRequest(url, contenttype, request)
    response = json.loads(output)"Output: {}, json: {}".format(output, response))

    message = "{} {}".format(response.get("answer"), response.get("card", {}).get("title", ""))


Because I use gboard, I can even issue my command by voice :slight_smile: