mirror of
https://github.com/MrSedan/neuro-reply-bot-reworked.git
synced 2026-01-14 21:49:42 +03:00
feat: started proxy alerts
This commit is contained in:
17
handlers/message_handlers/proxy/proxy_status_command.py
Normal file
17
handlers/message_handlers/proxy/proxy_status_command.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from datetime import datetime
|
||||
|
||||
from aiogram import types
|
||||
from aiogram.utils.keyboard import InlineKeyboardBuilder
|
||||
|
||||
from handlers.filters.proxy_status import ProxyStatusFilter
|
||||
|
||||
from ..handler import MessageHandlerABC
|
||||
|
||||
|
||||
class ProxyStatusCallback(MessageHandlerABC):
|
||||
filter = ProxyStatusFilter()
|
||||
async def _command(self, data: types.CallbackQuery):
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.button(text="Обновить статус🔄", callback_data="refresh_proxy_status")
|
||||
date = datetime.now().strftime("%d.%m.%Y %H:%M:%S")
|
||||
await self.bot.edit_message_text(f'{date} - Работаит', data.message.chat.id, data.message.message_id, reply_markup=builder.as_markup())
|
||||
@@ -0,0 +1,18 @@
|
||||
from datetime import datetime
|
||||
|
||||
from aiogram import types
|
||||
from aiogram.utils.keyboard import InlineKeyboardBuilder
|
||||
|
||||
from handlers.filters.refresh_proxy import RefreshProxyFilter
|
||||
|
||||
from ..handler import MessageHandlerABC
|
||||
|
||||
|
||||
class RefreshProxyStatusCallback(MessageHandlerABC):
|
||||
filter = RefreshProxyFilter()
|
||||
async def _command(self, data: types.CallbackQuery):
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.button(text="Обновить статус🔄", callback_data="refresh_proxy_status")
|
||||
date = datetime.now().strftime("%d.%m.%Y %H:%M:%S")
|
||||
await self.bot.edit_message_text(f'{date} - Работаит', data.message.chat.id, data.message.message_id, reply_markup=builder.as_markup())
|
||||
|
||||
38
handlers/message_handlers/proxy/start_command.py
Normal file
38
handlers/message_handlers/proxy/start_command.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
from aiogram.filters import CommandStart
|
||||
from aiogram.types import Message
|
||||
from aiogram.utils.keyboard import InlineKeyboardBuilder
|
||||
|
||||
from neuroapi import neuroapi
|
||||
|
||||
from ..handler import MessageHandlerABC
|
||||
|
||||
|
||||
class ProxyStartCommand(MessageHandlerABC):
|
||||
filter = CommandStart()
|
||||
async def _command(self, message: Message):
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.button(text="Статус прокси📝", callback_data="proxy_status")
|
||||
is_admin = await neuroapi.admin.is_admin(message.from_user.id)
|
||||
if is_admin:
|
||||
builder.button(text="Всё плохо", callback_data="proxy_disable")
|
||||
|
||||
markup = None # builder.as_markup()
|
||||
|
||||
#TODO: Users to send list
|
||||
users = dict()
|
||||
|
||||
if os.path.exists('users.json'):
|
||||
with open('users.json', 'r') as f:
|
||||
users = json.load(f)['users']
|
||||
else:
|
||||
with open('users.json', 'w+') as f:
|
||||
json.dump({'users': [message.from_user.id]}, f)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
await message.answer('Приветствуем, теперь вы будете получать оповещения о статусе прокси.', reply_markup=markup)
|
||||
Reference in New Issue
Block a user