Adapt to changes in telegram's api

This commit is contained in:
drymer 2017-07-09 03:04:25 +02:00
parent fe1cc0eed9
commit 002df9336e
3 changed files with 14 additions and 4 deletions

View File

@ -111,6 +111,10 @@ class Jabbergram(sleekxmpp.ClientXMPP):
name = '' name = ''
size = 0 size = 0
if update.edited_message:
update_id = update.update_id + 1
continue
if update.message.from_user: if update.message.from_user:
user = str(update.message.from_user.username) user = str(update.message.from_user.username)
@ -176,7 +180,7 @@ class Jabbergram(sleekxmpp.ClientXMPP):
'but the XMPP server doesn\'t support H'\ 'but the XMPP server doesn\'t support H'\
'TTP Upload.' 'TTP Upload.'
elif update.message.new_chat_member: elif update.message.new_chat_members:
message = 'This user has joined the group.' message = 'This user has joined the group.'
elif update.message.left_chat_member: elif update.message.left_chat_member:
message = 'This user has left the group.' message = 'This user has left the group.'
@ -203,7 +207,10 @@ class Jabbergram(sleekxmpp.ClientXMPP):
else: else:
msg = user + ": " + message 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: if chat not in self.groups:
chat = str(update.message.chat_id) chat = str(update.message.chat_id)

View File

@ -1,3 +1,3 @@
sleekxmpp >= 1.3.1 sleekxmpp >= 1.3.2
python-telegram-bot >= 4.0.3 python-telegram-bot >= 6.1.0
requests >= 2.11.1 requests >= 2.11.1

View File

@ -30,6 +30,9 @@ printed = []
while True: while True:
try: try:
for update in bot.getUpdates(offset=update_id, timeout=10): 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_id = update.message.chat_id
chat_title = update.message chat_title = update.message
if chat_id not in printed: if chat_id not in printed: