refactor stan
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
""" Send User's info. """
|
||||
import shelve
|
||||
import logging
|
||||
from . import report
|
||||
from .config import DATA
|
||||
from urllib import parse
|
||||
from telebot import types
|
||||
|
||||
@@ -16,3 +20,15 @@ def detect_args(message: types.Message):
|
||||
else:
|
||||
if len(message.text.split()) > 1:
|
||||
return ' '.join(message.text.split()[1:])
|
||||
|
||||
|
||||
def update_stats(message: types.Message):
|
||||
with shelve.open(f'{DATA}{message.chat.id}', writeback=True) as s:
|
||||
if 'Messages' not in s:
|
||||
report.reset_report_stats(message.chat.id)
|
||||
|
||||
if message.from_user.id not in s['Messages']:
|
||||
s['Messages'][message.from_user.id] = {'User': message.from_user, 'Count': 1}
|
||||
logging.warning(f'CNTR {message.chat.id}: {message.from_user.first_name} ({message.from_user.id})')
|
||||
else:
|
||||
s['Messages'][message.from_user.id]['Count'] += 1
|
||||
|
||||
Reference in New Issue
Block a user