This commit is contained in:
drymer 2016-09-26 14:21:28 +02:00
parent ab32df76ee
commit 0a348f05a5
1 changed files with 4 additions and 3 deletions

View File

@ -99,26 +99,27 @@ class Jabbergram(sleekxmpp.ClientXMPP):
if update.message.audio: if update.message.audio:
d_file = update.message.audio d_file = update.message.audio
ext = '.ogg' ext = '.ogg'
size = d_file.file_size
elif update.message.document: elif update.message.document:
d_file = update.message.document d_file = update.message.document
ext = '' ext = ''
size = d_file.file_size
elif update.message.photo: elif update.message.photo:
d_file = update.message.photo[-1] d_file = update.message.photo[-1]
ext = '.jpg' ext = '.jpg'
size = d_file.file_size
elif update.message.video: elif update.message.video:
d_file = update.message.video[-1] d_file = update.message.video[-1]
ext = '.mp4' ext = '.mp4'
size = d_file.file_size
elif update.message.voice: elif update.message.voice:
d_file = update.message.voice d_file = update.message.voice
ext = '.ogg' ext = '.ogg'
size = d_file.file_size size = d_file.file_size
if self.max_size >= size: if self.max_size >= size:
t_file = self.bot.getFile(d_file.file_id) t_file = self.bot.getFile(d_file.file_id)
name = '/tmp/' + d_file.file_id + ext name = '/tmp/' + d_file.file_id + ext
t_file.download(name) t_file.download(name)
url = self.http_upload.upload( url = self.http_upload.upload(
self.component, self.component,
'', name, size) '', name, size)