This commit is contained in:
parent
ee27dbfd7b
commit
53bac66692
@ -18,7 +18,7 @@ def append_post_to_cleaning_sequence(message, type=None):
|
|||||||
print(e2)
|
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:
|
try:
|
||||||
#posts = [p for p in collections.get_posts_removal_collection().all( ) ]
|
#posts = [p for p in collections.get_posts_removal_collection().all( ) ]
|
||||||
@ -36,7 +36,9 @@ def get_posts_to_be_removed(chat_id, type=None):
|
|||||||
if timediff > 60:
|
if timediff > 60:
|
||||||
posts_ret.append(p)
|
posts_ret.append(p)
|
||||||
|
|
||||||
print(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])]
|
posts_ret = [ p for p in posts_ret if p['msg_id'] != max([pp['msg_id'] for pp in posts_ret])]
|
||||||
### оставлять последний пост
|
### оставлять последний пост
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ async def up_dick(message: types.Message):
|
|||||||
|
|
||||||
|
|
||||||
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__DICK')
|
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__DICK')
|
||||||
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__DICK')
|
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__DICK', max_id=message.message_id)
|
||||||
|
|
||||||
#### TODO уплатить нолог с 100 см для самого нищего
|
#### TODO уплатить нолог с 100 см для самого нищего
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ async def up_dick(message: types.Message):
|
|||||||
user_stuff.update_attempts( message, user)
|
user_stuff.update_attempts( message, user)
|
||||||
|
|
||||||
postcleaner.append_post_to_cleaning_sequence(message=mmm, type='ALREADY_ROLLED')
|
postcleaner.append_post_to_cleaning_sequence(message=mmm, type='ALREADY_ROLLED')
|
||||||
await clean_posts(chat_id=mmm.chat.id, type='ALREADY_ROLLED')
|
await clean_posts(chat_id=mmm.chat.id, type='ALREADY_ROLLED', max_id=mmm.message_id)
|
||||||
else:
|
else:
|
||||||
## если нету, то создать
|
## если нету, то создать
|
||||||
user_stuff.store_new_user(message, result)
|
user_stuff.store_new_user(message, result)
|
||||||
@ -83,11 +83,11 @@ async def send_topchat(message: types.Message):
|
|||||||
if top_:
|
if top_:
|
||||||
dickos = tops.get_tops( top_ = True, chat_id=message.chat.id )
|
dickos = tops.get_tops( top_ = True, chat_id=message.chat.id )
|
||||||
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__TOPDICK')
|
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__TOPDICK')
|
||||||
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__TOPDICK')
|
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__TOPDICK', max_id=message.message_id)
|
||||||
elif glob_:
|
elif glob_:
|
||||||
dickos = tops.get_tops( glob_ = True )
|
dickos = tops.get_tops( glob_ = True )
|
||||||
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__GLOBALDICK')
|
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__GLOBALDICK')
|
||||||
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__GLOBALDICK')
|
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__GLOBALDICK', max_id=message.message_id)
|
||||||
else:
|
else:
|
||||||
print('вызывают хз что!')
|
print('вызывают хз что!')
|
||||||
|
|
||||||
@ -104,9 +104,8 @@ async def send_topchat(message: types.Message):
|
|||||||
'Вы можете посмотреть топ по миру /globaldick')
|
'Вы можете посмотреть топ по миру /globaldick')
|
||||||
|
|
||||||
|
|
||||||
async def clean_posts(chat_id, type=None):
|
async def clean_posts(chat_id, type=None, max_id=None):
|
||||||
psts = postcleaner.get_posts_to_be_removed(chat_id, type)
|
psts = postcleaner.get_posts_to_be_removed(chat_id, type, max_id)
|
||||||
print(psts)
|
|
||||||
|
|
||||||
for p in psts:
|
for p in psts:
|
||||||
postcleaner.del_post(chat_id=p['chat_id'], msg_id=p['msg_id'])
|
postcleaner.del_post(chat_id=p['chat_id'], msg_id=p['msg_id'])
|
||||||
|
Loading…
Reference in New Issue
Block a user