Adapt to changes in telegram's api
This commit is contained in:
parent
fe1cc0eed9
commit
002df9336e
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue