-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
38 lines (33 loc) · 1.33 KB
/
main.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
def run():
if __package__ is None:
import sys
from os import path
print(path.dirname( path.dirname( path.abspath(__file__) ) ))
sys.path.append(path.dirname( path.dirname( path.abspath(__file__) ) ))
from bot.noticebot import NoticeBot
from crawler.crawler import Crawler
from const import Url, FilePath
else:
from bot.noticebot import NoticeBot
from crawler.crawler import Crawler
from const import Url, FilePath
path = FilePath
bot_list = []
for key, webhook in Url.webhooks.items():
if "under" in key:
nb = [NoticeBot(Crawler.crawl_ssu_notice, webhook, path.crawler_data["ssu_info"], seek_time=7200),
NoticeBot(Crawler.crawl_sw_dept_notice, webhook, path.crawler_data["sw_dept_info"]),
NoticeBot(Crawler.crawl_sw_job_notice, webhook, path.crawler_data["sw_job_info"])]
elif "test" in key:
continue
else:
nb = [NoticeBot(Crawler.crawl_grad_notice, webhook, path.crawler_data["grad_info"]),
NoticeBot(Crawler.crawl_sw_grad_notice, webhook, path.crawler_data["sw_grad_info"])]
bot_list += nb
for bot in bot_list:
bot.daemon = True
bot.start()
for bot in bot_list:
bot.join()
if __name__ == '__main__':
run()