debugging

This commit is contained in:
2019-03-10 17:29:57 +01:00
parent 57b4a680f0
commit 33553d9db0

View File

@@ -166,18 +166,18 @@ class XMPPTelegram(ComponentXMPP):
# detect media # detect media
if "oob" in iq: try:
logging.debug("Found OOB content in message") url = iq['oob']['url']
if "url" in iq['oob']: logging.debug("Found OOB URL: {}".format(url))
url = iq['oob']['url'] if url.split('.')[-1] in self.config['media_external_formats']:
logging.debug("Found OOB URL: {}".format(url)) logging.debug("Media found")
if url.split('.')[-1] in self.config['media_external_formats']: media = InputMediaPhotoExternal(url, "Image")
logging.debug("Media found") try:
media = InputMediaPhotoExternal(url, "Image") result = self.tg_connections[jid].invoke(SendMediaRequest(tg_peer, media, "Image", random_id = generate_random_long(), reply_to_msg_id = reply_mid))
try: except Exception:
result = self.tg_connections[jid].invoke(SendMediaRequest(tg_peer, media, "Image", random_id = generate_random_long(), reply_to_msg_id = reply_mid)) print('Media upload failed.')
except Exception: except KeyError:
print('Media upload failed.') logging.debug("No OOB found")
# media send failed. # # media send failed. #
if not result: if not result: