fix robot

This commit is contained in:
bakatrouble 2021-03-15 22:14:34 +03:00
parent 70114b5d53
commit 82f61833e7

View File

@ -43,12 +43,11 @@ class RobotBotModuleConfig(TelegramBotModuleConfig):
file = ctx.bot.get_file(file_id)
filename = os.path.basename(file.file_path)
logging.warning(str(file.__dict__))
with TemporaryDirectory() as d:
file_path = os.path.join(d, filename)
file.download(file_path)
s3 = boto3.client('s3', aws_access_key_id=config.aws_access_key_id, aws_secret_access_key=config.aws_secret_access_key)
s3.upload_file(file_path, config.s3_bucket, filename)
s3.upload_file(file_path, config.s3_bucket, filename, extra_args={'ACL': 'public-read'})
file_url = f'https://{config.s3_bucket}.s3.amazonaws.com/{filename}'
if update.message.photo:
markup.inline_keyboard = [[