From 002df9336e61847766875f93d9c89683216c344a Mon Sep 17 00:00:00 2001 From: drymer Date: Sun, 9 Jul 2017 03:04:25 +0200 Subject: [PATCH] Adapt to changes in telegram's api --- jabbergram.py | 11 +++++++++-- requirements.txt | 4 ++-- seeIdGroups.py | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/jabbergram.py b/jabbergram.py index 9af09cd..dfde2bc 100755 --- a/jabbergram.py +++ b/jabbergram.py @@ -111,6 +111,10 @@ class Jabbergram(sleekxmpp.ClientXMPP): name = '' size = 0 + if update.edited_message: + update_id = update.update_id + 1 + continue + if update.message.from_user: user = str(update.message.from_user.username) @@ -176,7 +180,7 @@ class Jabbergram(sleekxmpp.ClientXMPP): 'but the XMPP server doesn\'t support H'\ 'TTP Upload.' - elif update.message.new_chat_member: + elif update.message.new_chat_members: message = 'This user has joined the group.' elif update.message.left_chat_member: message = 'This user has left the group.' @@ -203,7 +207,10 @@ class Jabbergram(sleekxmpp.ClientXMPP): else: msg = user + ": " + message - chat = '@' + update.message.chat.username + if update.message.chat.type == 'supergroup': + chat = '@' + update.message.chat.username + else: + chat = str(update.message.chat.id) if chat not in self.groups: chat = str(update.message.chat_id) diff --git a/requirements.txt b/requirements.txt index 8a7ccd6..310fa18 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -sleekxmpp >= 1.3.1 -python-telegram-bot >= 4.0.3 +sleekxmpp >= 1.3.2 +python-telegram-bot >= 6.1.0 requests >= 2.11.1 diff --git a/seeIdGroups.py b/seeIdGroups.py index 4cb7612..3f145c4 100644 --- a/seeIdGroups.py +++ b/seeIdGroups.py @@ -30,6 +30,9 @@ printed = [] while True: try: for update in bot.getUpdates(offset=update_id, timeout=10): + if update.edited_message: + update_id = update.update_id + 1 + continue chat_id = update.message.chat_id chat_title = update.message if chat_id not in printed: