From 4fa79b0010b96dc37f9ddfe5466aa632e04f3dfe Mon Sep 17 00:00:00 2001 From: Yannik Enss Date: Tue, 26 Feb 2019 14:02:02 +0100 Subject: [PATCH] list roster via chat and fix media --- xmpp_tg/xmpp.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xmpp_tg/xmpp.py b/xmpp_tg/xmpp.py index cd12bf2..d7e101f 100644 --- a/xmpp_tg/xmpp.py +++ b/xmpp_tg/xmpp.py @@ -147,7 +147,7 @@ class XMPPTelegram(ComponentXMPP): if msg.startswith('http') and re.match(r'(?:http\:|https\:)?\/\/.*\.(?:' + self.config['media_external_formats'] + ')', msg): urls = re.findall(r'(?:http\:|https\:)?\/\/.*\.(?:' + self.config['media_external_formats'] + ')', msg) message = msg.replace(urls[0], '') - media = InputMediaPhotoExternal(urls[0]) + media = InputMediaPhotoExternal(urls[0], "Image") try: result = self.tg_connections[jid].invoke(SendMediaRequest(tg_peer, media, message, random_id = generate_random_long(), reply_to_msg_id = reply_mid)) except Exception: @@ -283,6 +283,8 @@ class XMPPTelegram(ComponentXMPP): '!name first last - Change your name in Telegram\n' '!about text - Change about text in Telegram\n' '!username - Changes your @username in Telegram\n' + + '!roster - Lists yout TG roster\n\n' ) elif parsed[0] == '!configure': config_exclude = ['jid', 'tg_phone'] @@ -414,6 +416,9 @@ class XMPPTelegram(ComponentXMPP): contact = InputPhoneContact(client_id=generate_random_long(), phone=phone, first_name=firstname, last_name=lastname) self.tg_connections[jid].invoke(ImportContactsRequest([contact])) self.tg_process_dialogs(jid) + + elif parsed[0] == '!roster': # create new channel + self.gate_reply_message(iq, str(self.contact_list[jid])) else: # -------------------------------------------------- self.gate_reply_message(iq, 'Unknown command. Try !help for list all commands.')