I add command /admin /vadmin /iadmin /hello I create database and I improve code

It's version 0.3.0
This commit is contained in:
Niken
2025-10-11 23:02:30 +03:00
parent cce8c7dc70
commit 772d3d5b83
17 changed files with 349 additions and 18 deletions
+5 -1
View File
@@ -3,7 +3,7 @@ from aiogram.types import Message
from aiogram.filters import Command
from config import Config
from models.state import BotState
from utils.antispam import admin_required
from utils.antispam import admin_required, saving
from services.watcher_service import WatcherService
from storage.message_storage import load_messages, save_message, clear_messages
from logging import getLogger
@@ -17,6 +17,7 @@ logger = getLogger(__name__)
def register_handlers(dp: Dispatcher, state: BotState, bot: Bot):
@dp.message(Command("log"))
@saving
@admin_required(3)
async def send_log(message: Message):
try:
@@ -26,6 +27,7 @@ def register_handlers(dp: Dispatcher, state: BotState, bot: Bot):
await message.answer("Файл логов пока не создан.")
@dp.message(Command("status"))
@saving
@admin_required(3)
async def send_status(message: Message):
from utils.analytics import analyze_bot_logs
@@ -48,6 +50,7 @@ def register_handlers(dp: Dispatcher, state: BotState, bot: Bot):
await message.answer(f"❌ Ошибка при проверке статуса: {str(e)}")
@dp.message(Command("analytics"))
@saving
@admin_required(1)
async def stat(message: Message):
from utils.analytics import analyze_bot_logs
@@ -78,6 +81,7 @@ def register_handlers(dp: Dispatcher, state: BotState, bot: Bot):
save_message(sent.chat.id, sent.message_id)
@dp.message(Command("power"))
@saving
@admin_required(2)
async def power_control(message: types.Message):
args = message.text.split()
+2 -1
View File
@@ -2,12 +2,13 @@ from aiogram import types, Dispatcher
from aiogram.filters import Command
from models.state import BotState
from services.schedule_service import ScheduleService
from utils.antispam import is_chat_spam
from utils.antispam import is_chat_spam, saving
from storage.message_storage import save_message
def register_handlers(dp: Dispatcher, state: BotState):
@dp.message(Command("rasp"))
@saving
async def send_schedule(message: types.Message):
"""Отправка расписания"""
if is_chat_spam(message.chat.id, state):