mirror of
https://github.com/djimboy/djimbo_template_aio3.git
synced 2026-07-25 09:44:29 +00:00
Update
This commit is contained in:
@@ -4,22 +4,22 @@ from aiogram.types import BotCommand, BotCommandScopeChat, BotCommandScopeDefaul
|
||||
|
||||
from tgbot.data.config import get_admins
|
||||
|
||||
# Команды для юзеров
|
||||
# Commands for users
|
||||
user_commands = [
|
||||
BotCommand(command="start", description="♻️ Restart bot"),
|
||||
BotCommand(command="inline", description="🌀 Get Inline keyboard"),
|
||||
BotCommand(command="menu", description="🌀 Get keyboards"),
|
||||
]
|
||||
|
||||
# Команды для админов
|
||||
# Commands for admins
|
||||
admin_commands = [
|
||||
BotCommand(command="start", description="♻️ Restart bot"),
|
||||
BotCommand(command="inline", description="🌀 Get Inline keyboard"),
|
||||
BotCommand(command="menu", description="🌀 Get keyboards"),
|
||||
BotCommand(command="log", description="🖨 Get Logs"),
|
||||
BotCommand(command="db", description="📦 Get Database"),
|
||||
]
|
||||
|
||||
|
||||
# Установка команд
|
||||
# Set commands
|
||||
async def set_commands(bot: Bot):
|
||||
await bot.set_my_commands(user_commands, scope=BotCommandScopeDefault())
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from aiogram.types import Message
|
||||
from tgbot.data.config import get_admins
|
||||
|
||||
|
||||
# Проверка на админа
|
||||
# Filter on admin right
|
||||
class IsAdmin(BaseFilter):
|
||||
async def __call__(self, message: Message) -> bool:
|
||||
if message.from_user.id in get_admins():
|
||||
|
||||
@@ -5,24 +5,24 @@ import colorlog
|
||||
|
||||
from tgbot.data.config import PATH_LOGS
|
||||
|
||||
# Формат логгирования
|
||||
# Logging format
|
||||
log_formatter_file = bot_logger.Formatter("%(levelname)s | %(asctime)s | %(filename)s:%(lineno)d | %(message)s")
|
||||
log_formatter_console = colorlog.ColoredFormatter(
|
||||
"%(purple)s%(levelname)s %(blue)s|%(purple)s %(asctime)s %(blue)s|%(purple)s %(filename)s:%(lineno)d %(blue)s|%(purple)s %(message)s%(red)s",
|
||||
datefmt="%d-%m-%Y %H:%M:%S",
|
||||
)
|
||||
|
||||
# Логгирование в файл logs.log
|
||||
# Logging in file logs.log
|
||||
file_handler = bot_logger.FileHandler(PATH_LOGS, "w", "utf-8")
|
||||
file_handler.setFormatter(log_formatter_file)
|
||||
file_handler.setLevel(bot_logger.INFO)
|
||||
|
||||
# Логгирование в консоль
|
||||
# Logging in console
|
||||
console_handler = bot_logger.StreamHandler()
|
||||
console_handler.setFormatter(log_formatter_console)
|
||||
console_handler.setLevel(bot_logger.CRITICAL)
|
||||
|
||||
# Подключение настроек логгирования
|
||||
# Connect logging settings
|
||||
bot_logger.basicConfig(
|
||||
format="%(levelname)s | %(asctime)s | %(filename)s:%(lineno)d | %(message)s",
|
||||
handlers=[
|
||||
|
||||
Reference in New Issue
Block a user