#5 fixxo
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simple_Not
2024-01-23 15:29:34 +10:00
parent ee27dbfd7b
commit 53bac66692
2 changed files with 12 additions and 11 deletions

View File

@@ -18,7 +18,7 @@ def append_post_to_cleaning_sequence(message, type=None):
print(e2)
def get_posts_to_be_removed(chat_id, type=None):
def get_posts_to_be_removed(chat_id, type=None, max_id=None):
# собираем
try:
#posts = [p for p in collections.get_posts_removal_collection().all( ) ]
@@ -35,9 +35,11 @@ def get_posts_to_be_removed(chat_id, type=None):
if timediff > 60:
posts_ret.append(p)
print(posts_ret)
posts_ret = [ p for p in posts_ret if p['msg_id'] != max([pp['msg_id'] for pp in posts_ret])]
if max_id:
posts_ret = [ p for p in posts_ret if p['msg_id'] != max_id)]
else:
posts_ret = [ p for p in posts_ret if p['msg_id'] != max([pp['msg_id'] for pp in posts_ret])]
### оставлять последний пост