瀏覽代碼

Don't crash when message without text

Basile Bruneau 8 年之前
父節點
當前提交
a10f69cad0
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      bot/views/telegram.py

+ 3 - 0
bot/views/telegram.py

123
         except:
123
         except:
124
             do_nothing = True
124
             do_nothing = True
125
 
125
 
126
+    if not 'text' in data['message']:
127
+        return HttpResponse(201)
128
+
126
     text = data['message']['text']
129
     text = data['message']['text']
127
     if text == '/notify_every_seum_or_not' or text == '/notify_every_seum_or_not@' + telegram_bot_name:
130
     if text == '/notify_every_seum_or_not' or text == '/notify_every_seum_or_not@' + telegram_bot_name:
128
         tchat = TelegramChat.objects.get(chat_id=chat['id'])
131
         tchat = TelegramChat.objects.get(chat_id=chat['id'])