-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetchmail_bot.py
executable file
·40 lines (29 loc) · 1 KB
/
fetchmail_bot.py
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
36
37
38
39
40
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import telebot
import logging
from config import config_util
from bot import receive_msg
#
# SET LOG LEVEL OF SCRIPT
#
LOG_LEVEL = logging.INFO
# telebot.logger.setLevel(logging.DEBUG)
format = "%(asctime)s - %(name)s - %(funcName)s : %(message)s"
logging.basicConfig(format=format, level=LOG_LEVEL, datefmt="%Y-%m-%d %H:%M:%S")
logger: logging.Logger = logging.getLogger(name="fetchmail_bot")
def main() -> None:
"""Main Program flow"""
logger.info("Start Main Program")
logger.debug("create config class instance")
config = config_util.Configuration()
logger.debug("initialize telegram bot instance")
bot = telebot.TeleBot(config.telegram_token, parse_mode=None)
# dynamic telegram bot commands = users to fetchmail for
logger.debug(msg="prepare telegram receive command instance")
receive_msg.ReceivingMessage(bot, config).start()
if __name__ == "__main__":
"""
Python main program start
"""
main()