aboutsummaryrefslogtreecommitdiffstats
path: root/project/botmanager.py
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2016-07-28 15:12:00 -0400
committerJan Tuomi <jans.tuomi@gmail.com>2016-07-28 15:12:00 -0400
commitbc99e19c4ccb7748cf010bd2318bb8a8941ec2ba (patch)
treeb601cc5203f9de4cd6afc0906a165e6f25d6903d /project/botmanager.py
parenta4ef3b69b530f1d3e52efda921bbc840319e9e26 (diff)
Fix bug where messages are answered in a wrong Telegram chat
Diffstat (limited to 'project/botmanager.py')
-rw-r--r--project/botmanager.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/project/botmanager.py b/project/botmanager.py
index 1a3e037..01f9c10 100644
--- a/project/botmanager.py
+++ b/project/botmanager.py
@@ -71,23 +71,16 @@ class BotManager(object):
songs = ["Ace of Spades", "Mökkitie", "Alpha Russian XXL Night Mixtape", "teekkarihymni"]
- def action_now_playing(self, msg):
- """Placeholder action for testing commands"""
- TelegramCommunicator.send_raw("Radiossa soi {}!".format(random.choice(BotManager.songs)))
-
def action_not_supported(self, msg):
"""Notify the user that the given command is not supported"""
- TelegramCommunicator.send_raw("Tätä toimintoa ei ole tuettu.")
+ chat_id = msg["chat"]
+ TelegramCommunicator.send_raw("Tätä toimintoa ei ole tuettu.", chat_id)
def parse_message(self, msg):
"""Determine which action to take for an incoming Telegram text message"""
t = msg["text"]
content_type, chat_type, chat_id = telepot.glance(msg)
- if "/nowplaying" in t:
- self.action_now_playing(msg)
- elif "/start" in t:
- self.action_not_supported(msg)
- elif "/stop" in t:
+ if t in ("/start", "/stop"):
self.action_not_supported(msg)
elif str(chat_id) == TelegramCommunicator.chat_id.strip():
self.action_send_to_shoutbox(msg)