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
if "oob" in iq:
logging.debug("Found OOB content in message")
if "url" in iq['oob']:
url = iq['oob']['url']
logging.debug("Found OOB URL: {}".format(url))
if url.split('.')[-1] in self.config['media_external_formats']:
logging.debug("Media found")
media = InputMediaPhotoExternal(url, "Image")
try:
result = self.tg_connections[jid].invoke(SendMediaRequest(tg_peer, media, "Image", random_id = generate_random_long(), reply_to_msg_id = reply_mid))
except Exception:
print('Media upload failed.')
try:
url = iq['oob']['url']
logging.debug("Found OOB URL: {}".format(url))
if url.split('.')[-1] in self.config['media_external_formats']:
logging.debug("Media found")
media = InputMediaPhotoExternal(url, "Image")
try:
result = self.tg_connections[jid].invoke(SendMediaRequest(tg_peer, media, "Image", random_id = generate_random_long(), reply_to_msg_id = reply_mid))
except Exception:
print('Media upload failed.')
except KeyError:
logging.debug("No OOB found")
# media send failed. #
if not result: