media limit
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import logging
|
||||
import traceback
|
||||
from datetime import datetime, timedelta
|
||||
from html import escape
|
||||
from queue import Queue, Empty
|
||||
from time import sleep
|
||||
@@ -232,6 +233,16 @@ def users_list(bot: Bot, update: Update):
|
||||
|
||||
|
||||
def _process_message(bot: Bot, m: Message):
|
||||
if m.sticker or m.animation:
|
||||
delta = datetime.now() - conn.root.last_media
|
||||
if delta < timedelta(seconds=15):
|
||||
bot.send_message(
|
||||
m.from_user.id,
|
||||
'Не вайпи, до следующей гифки/стикера осталось {} секунд'.format(15 - int(delta.total_seconds()))
|
||||
)
|
||||
return
|
||||
conn.root.last_media = datetime.now()
|
||||
commit()
|
||||
current_chat = m.chat_id
|
||||
users = conn.root.subscribers # type: Dict[int, Subscriber]
|
||||
if current_chat not in users:
|
||||
|
||||
Reference in New Issue
Block a user