-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
28 lines (23 loc) · 906 Bytes
/
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
import asyncio
import os.path
import sys
from datetime import time, timezone, timedelta
from lightq import Bot
sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
from leetcode_bot import LeetCodeController, Config
async def main():
config = Config.from_file(os.path.join(os.path.dirname(__file__), 'config.json'))
bot = Bot(config.bot_id, config.verify_key, config.base_url)
controller = LeetCodeController(bot, config)
bot.add_all(controller.handlers())
bot.create_everyday_task(
time(0, 0, 1, tzinfo=timezone(timedelta(hours=0))),
controller.push_en_daily_to_groups
) # push en daily at 00:00 (UTC+0)
bot.create_everyday_task(
time(0, 0, 1, tzinfo=timezone(timedelta(hours=8))),
controller.push_cn_daily_to_groups
) # push cn daily at 00:00 (UTC+8)
await bot.run()
if __name__ == '__main__':
asyncio.run(main())