mirror of
https://github.com/civsocit/olgram.git
synced 2025-12-15 08:16:17 +00:00
Немного статистики
This commit is contained in:
@@ -7,6 +7,7 @@ from contextvars import ContextVar
|
||||
from aiohttp.web_exceptions import HTTPNotFound
|
||||
from aioredis.commands import create_redis_pool
|
||||
from aioredis import Redis
|
||||
from tortoise.expressions import F
|
||||
import logging
|
||||
import typing as ty
|
||||
from olgram.settings import ServerSettings
|
||||
@@ -55,6 +56,9 @@ async def message_handler(message: types.Message, *args, **kwargs):
|
||||
return SendMessage(chat_id=message.chat.id,
|
||||
text="Вы заблокированы в этом боте")
|
||||
|
||||
bot.incoming_messages_count = F("incoming_messages_count") + 1
|
||||
await bot.save(update_fields=["incoming_messages_count"])
|
||||
|
||||
# Пересылаем сообщение в супер-чат
|
||||
if is_super_group:
|
||||
thread_first_message = await _redis.get(_thread_uniqie_id(bot.pk, message.chat.id))
|
||||
@@ -109,6 +113,9 @@ async def message_handler(message: types.Message, *args, **kwargs):
|
||||
await message.reply("<i>Невозможно переслать сообщение (автор заблокировал бота?)</i>",
|
||||
parse_mode="HTML")
|
||||
return
|
||||
|
||||
bot.outgoing_messages_count = F("outgoing_messages_count") + 1
|
||||
await bot.save(update_fields=["outgoing_messages_count"])
|
||||
elif super_chat_id > 0:
|
||||
# в супер-чате кто-то пишет сообщение сам себе, только для личных сообщений
|
||||
await message.forward(super_chat_id)
|
||||
|
||||
Reference in New Issue
Block a user