mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-04 03:10:01 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -243,6 +243,11 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
|
|||||||
|
|
||||||
## 更新
|
## 更新
|
||||||
|
|
||||||
|
### 2022/7/16
|
||||||
|
|
||||||
|
* cos提供连发命令
|
||||||
|
* 修复B站视频解析中b23解析错误
|
||||||
|
|
||||||
### 2022/7/13
|
### 2022/7/13
|
||||||
|
|
||||||
* B站订阅提供配置项`LIVE_MSG_AT_ALL`,`UP_MSG_AT_ALL`:控制UP动态投稿和直播是否AT全体
|
* B站订阅提供配置项`LIVE_MSG_AT_ALL`,`UP_MSG_AT_ALL`:控制UP动态投稿和直播是否AT全体
|
||||||
|
|||||||
+20
-13
@@ -1,4 +1,7 @@
|
|||||||
|
from typing import Tuple, Any
|
||||||
|
|
||||||
from nonebot import on_regex
|
from nonebot import on_regex
|
||||||
|
from nonebot.params import RegexGroup
|
||||||
from nonebot.typing import T_State
|
from nonebot.typing import T_State
|
||||||
from nonebot.adapters.onebot.v11 import Bot, MessageEvent
|
from nonebot.adapters.onebot.v11 import Bot, MessageEvent
|
||||||
from utils.message_builder import image
|
from utils.message_builder import image
|
||||||
@@ -11,7 +14,9 @@ __plugin_usage__ = """
|
|||||||
usage:
|
usage:
|
||||||
三次元也不戳,嘿嘿嘿
|
三次元也不戳,嘿嘿嘿
|
||||||
指令:
|
指令:
|
||||||
cos/coser
|
?N连cos/coser
|
||||||
|
示例:cos
|
||||||
|
示例:5连cos (单次请求张数小于9)
|
||||||
""".strip()
|
""".strip()
|
||||||
__plugin_des__ = "三次元也不戳,嘿嘿嘿"
|
__plugin_des__ = "三次元也不戳,嘿嘿嘿"
|
||||||
__plugin_cmd__ = ["cos/coser"]
|
__plugin_cmd__ = ["cos/coser"]
|
||||||
@@ -31,21 +36,23 @@ __plugin_configs__ = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
coser = on_regex("^(cos|COS|coser|括丝)$", priority=5, block=True)
|
coser = on_regex(r"^(\d)连?(cos|COS|coser|括丝)$", priority=5, block=True)
|
||||||
|
|
||||||
|
|
||||||
url = "https://api.iyk0.com/cos"
|
url = "https://api.iyk0.com/cos"
|
||||||
|
|
||||||
|
|
||||||
@coser.handle()
|
@coser.handle()
|
||||||
async def _(bot: Bot, event: MessageEvent, state: T_State):
|
async def _(bot: Bot, event: MessageEvent, reg_group: Tuple[Any, ...] = RegexGroup()):
|
||||||
try:
|
num = reg_group[0] or 1
|
||||||
msg_id = await coser.send(image(url))
|
for _ in range(int(num)):
|
||||||
withdraw_message_manager.withdraw_message(
|
try:
|
||||||
event,
|
msg_id = await coser.send(image(url))
|
||||||
msg_id["message_id"],
|
withdraw_message_manager.withdraw_message(
|
||||||
Config.get_config("coser", "WITHDRAW_COS_MESSAGE"),
|
event,
|
||||||
)
|
msg_id["message_id"],
|
||||||
except Exception as e:
|
Config.get_config("coser", "WITHDRAW_COS_MESSAGE"),
|
||||||
await coser.send("你cos给我看!")
|
)
|
||||||
logger.error(f"coser 发送了未知错误 {type(e)}:{e}")
|
except Exception as e:
|
||||||
|
await coser.send("你cos给我看!")
|
||||||
|
logger.error(f"coser 发送了未知错误 {type(e)}:{e}")
|
||||||
|
|||||||
@@ -56,18 +56,11 @@ async def _(event: GroupMessageEvent):
|
|||||||
) as session:
|
) as session:
|
||||||
async with session.get(
|
async with session.get(
|
||||||
data["meta"]["detail_1"]["qqdocurl"],
|
data["meta"]["detail_1"]["qqdocurl"],
|
||||||
proxy=get_local_proxy(),
|
|
||||||
timeout=7,
|
timeout=7,
|
||||||
) as response:
|
) as response:
|
||||||
url = str(response.url).split("?")[0]
|
url = str(response.url).split("?")[0]
|
||||||
bvid = url.split("/")[-1]
|
bvid = url.split("/")[-1]
|
||||||
vd_info = await video.get_video_base_info(bvid)
|
vd_info = await video.get_video_base_info(bvid)
|
||||||
# response = await AsyncHttpx.get(
|
|
||||||
# data["meta"]["detail_1"]["qqdocurl"], timeout=7
|
|
||||||
# )
|
|
||||||
# url = str(response.url).split("?")[0]
|
|
||||||
# bvid = url.split("/")[-1]
|
|
||||||
# vd_info = await video.Video(bvid=bvid).get_info()
|
|
||||||
# 转发专栏
|
# 转发专栏
|
||||||
if (
|
if (
|
||||||
data.get("meta")
|
data.get("meta")
|
||||||
@@ -123,11 +116,17 @@ async def _(event: GroupMessageEvent):
|
|||||||
url = f"https://www.bilibili.com/video/{msg}"
|
url = f"https://www.bilibili.com/video/{msg}"
|
||||||
vd_info = await video.get_video_base_info(msg)
|
vd_info = await video.get_video_base_info(msg)
|
||||||
elif "https://b23.tv" in msg:
|
elif "https://b23.tv" in msg:
|
||||||
url = "https://" + msg[msg.find("b23.tv") : msg.find("b23.tv") + 13]
|
url = "https://" + msg[msg.find("b23.tv"): msg.find("b23.tv") + 14]
|
||||||
res = await AsyncHttpx.get(url, timeout=7)
|
async with aiohttp.ClientSession(
|
||||||
url = str(res.url).split("?")[0]
|
headers=get_user_agent()
|
||||||
bvid = url.split("/")[-1]
|
) as session:
|
||||||
vd_info = await video.get_video_base_info(bvid)
|
async with session.get(
|
||||||
|
url,
|
||||||
|
timeout=7,
|
||||||
|
) as response:
|
||||||
|
url = str(response.url).split("?")[0]
|
||||||
|
bvid = url.split("/")[-1]
|
||||||
|
vd_info = await video.get_video_base_info(bvid)
|
||||||
if vd_info:
|
if vd_info:
|
||||||
if (
|
if (
|
||||||
url in _tmp.keys() and time.time() - _tmp[url] > 30
|
url in _tmp.keys() and time.time() - _tmp[url] > 30
|
||||||
|
|||||||
Reference in New Issue
Block a user