Merge pull request #951 from yajiwa/main

替换了cos和bt的url
This commit is contained in:
HibiKier 2022-07-30 10:53:49 +08:00 committed by GitHub
commit d1b6dfe577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 24 deletions

View File

@ -9,7 +9,7 @@ import platform
# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
url = "http://www.eclzz.zone/" url = "http://www.eclzz.plus"
async def get_bt_info(keyword: str, page: int): async def get_bt_info(keyword: str, page: int):

View File

@ -36,10 +36,11 @@ __plugin_configs__ = {
}, },
} }
coser = on_regex(r"^(\d)连?(cos|COS|coser|括丝)$", priority=5, block=True) coser = on_regex(r"^(\d?)连?(cos|COS|coser|括丝)$", priority=5, block=True)
# 纯cos较慢:https://picture.yinux.workers.dev
url = "https://api.iyk0.com/cos" # 比较杂,有福利姬,较快:https://api.jrsgslb.cn/cos/url.php?return=img
url = "https://picture.yinux.workers.dev/"
@coser.handle() @coser.handle()

View File

@ -40,28 +40,30 @@ wbtop_data = []
async def _(event: MessageEvent, arg: Message = CommandArg()): async def _(event: MessageEvent, arg: Message = CommandArg()):
global wbtop_data global wbtop_data
msg = arg.extract_plain_text().strip() msg = arg.extract_plain_text().strip()
if not wbtop_data or not msg: if wbtop_data:
if wbtop_data: now_time = datetime.datetime.now()
now_time = datetime.datetime.now() if now_time > wbtop_data["time"] + datetime.timedelta(minutes=5):
if now_time > wbtop_data["time"] + datetime.timedelta(minutes=5):
data, code = await get_wbtop(wbtop_url)
if code != 200:
await wbtop.finish(data, at_sender=True)
wbtop_data = data
else:
data, code = await get_wbtop(wbtop_url) data, code = await get_wbtop(wbtop_url)
if code != 200: if code != 200:
await wbtop.finish(data, at_sender=True) await wbtop.finish(data, at_sender=True)
else:
wbtop_data = data
else:
data, code = await get_wbtop(wbtop_url)
if code != 200:
await wbtop.finish(data, at_sender=True)
else:
wbtop_data = data wbtop_data = data
if not msg:
img = await asyncio.get_event_loop().run_in_executor( if not msg:
None, gen_wbtop_pic, wbtop_data["data"] img = await asyncio.get_event_loop().run_in_executor(
) None, gen_wbtop_pic, wbtop_data["data"]
await wbtop.send(img) )
logger.info( await wbtop.send(img)
f"(USER {event.user_id}, GROUP {event.group_id if isinstance(event, GroupMessageEvent) else 'private'})" logger.info(
f" 查询微博热搜" f"(USER {event.user_id}, GROUP {event.group_id if isinstance(event, GroupMessageEvent) else 'private'})"
) f" 查询微博热搜"
)
if is_number(msg) and 0 < int(msg) <= 50: if is_number(msg) and 0 < int(msg) <= 50:
url = wbtop_data["data"][int(msg) - 1]["url"] url = wbtop_data["data"][int(msg) - 1]["url"]
await wbtop.send("开始截取数据...") await wbtop.send("开始截取数据...")
@ -72,7 +74,7 @@ async def _(event: MessageEvent, arg: Message = CommandArg()):
wait_time=12 wait_time=12
) )
if img: if img:
await wbtop.send(img) await wbtop.finish(img)
else: else:
await wbtop.send("发生了一些错误.....") await wbtop.finish("发生了一些错误.....")