app.bot.telegram.processor   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 36
dl 0
loc 79
rs 10
c 0
b 0
f 0

5 Functions

Rating   Name   Duplication   Size   Complexity  
A command_logli() 0 15 1
A command_gleci() 0 16 1
A callback_inline() 0 9 2
A command_start() 0 9 1
A cpx_messages_handler() 0 10 2
1
# pylint: disable=R0401
2
3
"""Processing commands received from telegram bot"""
4
5
from app.bot.telegram import bot, msg, cbq
6
from app.bot.telegram.handlers.commands import bot_cmd_start, bot_cmd_gle, bot_cmd_log
7
from app.bot.telegram.handlers.inline import bot_callback_inline
8
from app.bot.telegram.handlers.messages import bot_text_messages_handler
9
from app.decorators import logging_time
10
11
12
@bot.message_handler(commands=["start"])
13
@logging_time
14
async def command_start(message: msg):
15
    """
16
    Handle command /start
17
    :param message:
18
    :return:
19
    """
20
    await bot_cmd_start(message)
21
22
23
@bot.message_handler(
24
    commands=[
25
        "g",
26
        "e",
27
        "gle",
28
        "gleci",
29
    ]
30
)
31
@logging_time
32
async def command_gleci(message: msg):
33
    """
34
    Handle command /gleci
35
    :param message:
36
    :return:
37
    """
38
    await bot_cmd_gle(message)
39
40
41
@bot.message_handler(
42
    commands=[
43
        "l",
44
        "log",
45
        "logli",
46
    ]
47
)
48
@logging_time
49
async def command_logli(message: msg):
50
    """
51
    Handle command /logli
52
    :param message:
53
    :return:
54
    """
55
    await bot_cmd_log(message)
56
57
58
@bot.message_handler(regexp="/[a-z]+")
59
@bot.message_handler(func=lambda message: True, content_types=["text"])
60
@logging_time
61
async def cpx_messages_handler(message: msg):
62
    """
63
    All text requests to the bot are processed by this function
64
    :param message:
65
    :return:
66
    """
67
    await bot_text_messages_handler(message)
68
69
70
@bot.callback_query_handler(func=lambda call: True)
71
@logging_time
72
async def callback_inline(call: cbq):
73
    """
74
    All inline requests are processed by this function
75
    :param call: Incoming inline request
76
    :return:
77
    """
78
    await bot_callback_inline(call)
79