Files
neuro-reply-bot-reworked/handlers/message_handlers/proxy/start_command.py

38 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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)