Merge branch 'admin_commands' into dev

This commit is contained in:
2023-11-15 23:45:36 +03:00
2 changed files with 34 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ class Admin_commands:
Post.media_group_id == message.media_group_id).first()
if post:
photo = Image(message_id=message.message_id,
post=post, file_id=message.photo[-1].file_id)
post=post, file_id=message.photo[-1].file_id, has_spoiler=message.has_media_spoiler)
session.add(photo)
session.commit()
else:
@@ -202,7 +202,8 @@ class Admin_commands:
if post:
images = MediaGroupBuilder(caption=post.text)
for image in post.images:
images.add_photo(image.file_id)
images.add_photo(
image.file_id, has_spoiler=image.has_spoiler)
await message.answer_media_group(images.build())
post.posted = True
session.commit()
@@ -217,7 +218,7 @@ class Admin_commands:
post_user = session.get(Admin, message.from_user.id)
post.user = post_user
photo = Image(message_id=message.message_id,
post=post, file_id=message.photo[-1].file_id)
post=post, file_id=message.photo[-1].file_id, has_spoiler=message.has_media_spoiler)
session.add(photo)
session.add(post)
session.commit()