fix a bug
This commit is contained in:
parent
4d43438a4d
commit
cbbbb9c6a6
2
ci.py
2
ci.py
@ -44,6 +44,4 @@ client = AsyncClient(timeout=10.0, headers=headers, follow_redirects=True)
|
||||
|
||||
# 初始化客户端
|
||||
scheduler = AsyncIOScheduler(timezone="Asia/ShangHai")
|
||||
if not scheduler.running:
|
||||
scheduler.start()
|
||||
app = Client("bot", api_id=api_id, api_hash=api_hash, bot_token=bot_token, plugins={"root": "plugins"})
|
||||
|
4
main.py
4
main.py
@ -1,7 +1,9 @@
|
||||
import logging
|
||||
from ci import app
|
||||
from ci import app, scheduler
|
||||
|
||||
# 日志记录
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
print("Starting...")
|
||||
if not scheduler.running:
|
||||
scheduler.start()
|
||||
app.run()
|
||||
|
@ -1,5 +1,6 @@
|
||||
import contextlib
|
||||
import traceback
|
||||
|
||||
from asyncio import sleep
|
||||
from random import uniform
|
||||
|
||||
@ -39,7 +40,7 @@ async def send_new(new: New):
|
||||
return await send_new_photo(new) if new.img_urls else await send_new_text(new)
|
||||
|
||||
|
||||
@scheduler.scheduled_job("cron", minute="*/10", id="1")
|
||||
@scheduler.scheduled_job("cron", minute="*/10", id="track")
|
||||
async def run_every_10_minute():
|
||||
news = await get_news()
|
||||
news = sorted(news, key=lambda x: x.publish_time, reverse=False)
|
||||
|
Loading…
Reference in New Issue
Block a user