fix robot
This commit is contained in:
parent
70114b5d53
commit
82f61833e7
@ -43,12 +43,11 @@ class RobotBotModuleConfig(TelegramBotModuleConfig):
|
|||||||
|
|
||||||
file = ctx.bot.get_file(file_id)
|
file = ctx.bot.get_file(file_id)
|
||||||
filename = os.path.basename(file.file_path)
|
filename = os.path.basename(file.file_path)
|
||||||
logging.warning(str(file.__dict__))
|
|
||||||
with TemporaryDirectory() as d:
|
with TemporaryDirectory() as d:
|
||||||
file_path = os.path.join(d, filename)
|
file_path = os.path.join(d, filename)
|
||||||
file.download(file_path)
|
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 = 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}'
|
file_url = f'https://{config.s3_bucket}.s3.amazonaws.com/{filename}'
|
||||||
if update.message.photo:
|
if update.message.photo:
|
||||||
markup.inline_keyboard = [[
|
markup.inline_keyboard = [[
|
||||||
|
Loading…
Reference in New Issue
Block a user