support custom time

This commit is contained in:
xtaodada 2022-08-02 23:16:25 +08:00
parent ce119ac018
commit 27316040f9
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 5 additions and 3 deletions

View File

@ -5,8 +5,9 @@ from ci import client, sqlite
from defs.model import New
async def get_news() -> List[New]:
time = sqlite.get("update_time", time_.time() - 600)
async def get_news(time: int=None) -> List[New]:
if not time:
time = sqlite.get("update_time", int(time_.time()) - 600)
url = f"https://papi.jiemian.com/page/api/kuaixun/getLastest?cid=1325kb&end_time={time}&tagid=1325"
data = await client.get(url)
if data.status_code != 200:

View File

@ -63,5 +63,6 @@ async def run_every_10_minute():
@Client.on_message(filters.incoming & filters.private & filters.chat(admin_id) &
filters.command(["force_update", ]))
async def force_update(_: Client, message: Message):
await run_every_10_minute()
a = int(message.text.replace("/force_update", "").strip())
await run_every_10_minute(a)
await message.reply("ok!")