diff options
| author | jantuomi <jans.tuomi@gmail.com> | 2016-07-18 14:44:00 +0300 |
|---|---|---|
| committer | jantuomi <jans.tuomi@gmail.com> | 2016-07-18 14:44:00 +0300 |
| commit | 8e348559761c10558237e3185b09922f1e5aae40 (patch) | |
| tree | 6913e3f10759c87b2aae7205e377ac6dbc7ef4c0 /botmanager.py | |
| parent | 1aac753ba2e95276af63bbaaedae9c2e89cb91c2 (diff) | |
Forward messages from shoutbox to telegram successfully
Diffstat (limited to 'botmanager.py')
| -rw-r--r-- | botmanager.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/botmanager.py b/botmanager.py index 4d3fd86..9f18abc 100644 --- a/botmanager.py +++ b/botmanager.py @@ -41,7 +41,10 @@ class BotManager(object): logging.info("Listening for messages...") while True: # TODO send to telegram - Communicator.fetch(self.shoutbox_api_url) + messages = Communicator.fetch(self.shoutbox_api_url) + for message in messages: + self.bot.sendMessage(self.telegram_chat_id, + "{}: {}".format(message["user"], message["text"])) time.sleep(10) def default_action(self, chat_id): @@ -68,7 +71,7 @@ class BotManager(object): self.not_supported(chat_id) elif str(chat_id) == self.telegram_chat_id.strip(): user_name = msg["from"]["first_name"] - data = JSONFactory.make(t, user_name, msg["date"], "null") + data = JSONFactory.make_object(t, user_name, msg["date"], "null") logging.info("Created JSON packet:\n{}".format(data)) Communicator.send(self.shoutbox_api_url, data) else: |
