summaryrefslogtreecommitdiff
path: root/src/admin_bot.py
blob: 88e71e849b4ae392a0507389d0f588383a76e63b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
from typing import Optional
from telegram import ReplyKeyboardMarkup
from telegram.ext import MessageHandler
from home.config import config
from home.bot import Wrapper, Context, text_filter


def get_latest_logs(ctx: Context):
    u = ctx.user
    ctx.reply(ctx.lang('blbla'))


class AdminBot(Wrapper):
    def __init__(self):
        super().__init__()

        self.lang.ru(get_latest_logs="Смотреть последние логи")
        self.lang.en(get_latest_logs="Get latest logs")

        self.add_handler(MessageHandler(text_filter(self.lang('get_latest_logs')), self.wrap(get_latest_logs)))

    def markup(self, ctx: Optional[Context]) -> Optional[ReplyKeyboardMarkup]:
        buttons = [
            [self.lang('get_latest_logs')]
        ]
        return ReplyKeyboardMarkup(buttons, one_time_keyboard=False)


if __name__ == '__main__':
    config.load('admin_bot')

    bot = AdminBot()
    # bot.enable_logging(BotType.ADMIN)
    bot.run()