Skip to content

Instantly share code, notes, and snippets.

@jamesperes-zz
Created April 27, 2017 03:50
Show Gist options
  • Save jamesperes-zz/ae813b3103a9e2bf51f8587e7c898e08 to your computer and use it in GitHub Desktop.
Save jamesperes-zz/ae813b3103a9e2bf51f8587e7c898e08 to your computer and use it in GitHub Desktop.
def photo_list(bot, update):
nomes = UsuarioTelegram.objects.all()
user = update.message.from_user.first_name
photo_file = bot.getFile(update.message.photo[-1].file_id)
#url = settings.MEDIA_ROOT + '/uploads'
url='/tmp'
print(url)
for a in nomes:
if a.nome == user:
imagefile=photo_file.download(custom_path=url)
#Imagem.objects.create(usuario=a, imagem=photo_file.download(custom_path=url))
print('imagem enviada')
update.message.reply_text('Foto enviada para o sistema ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment