-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.py
More file actions
32 lines (22 loc) · 1.04 KB
/
start.py
File metadata and controls
32 lines (22 loc) · 1.04 KB
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
from CivUrlHandler import CivUrlHandler
from Bots.TelegramBot import TelegramBot
from CivCloudCommandHandler import CivCloudCommandHandler
from CivWebhookReceiver import CivWebhookReceiver
from ConfigReader import ConfigReader
import logging
import _thread
config = ConfigReader("configuration.yml")
logLevel = int(config.getProperty("CivCloudBot.logLevel"))
BaseURL = config.getProperty("CivCloudBot.BaseURL")
WebHookIP = config.getProperty("CivCloudBot.WebHookReceiver.ip")
WebHookPort = config.getProperty("CivCloudBot.WebHookReceiver.port")
TelegramApiKey = config.getProperty("CivCloudBot.Bots.Telegram.ApiKey")
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logLevel)
urlHandler = CivUrlHandler()
handler = CivCloudCommandHandler(urlHandler, BaseURL)
bot = TelegramBot(TelegramApiKey, handler)
botmap = {bot.getType(): bot}
receiver = CivWebhookReceiver(WebHookIP, WebHookPort, urlHandler, botmap)
_thread.start_new_thread(bot.run, ())
receiver.run()