mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-08-31 12:02:24 +08:00
fix interlog, add chromium to img, fix #20
This commit is contained in:
parent
b9ee2232f5
commit
7728615f56
@ -1,9 +1,12 @@
|
||||
FROM python:3.9
|
||||
RUN python3 -m pip install poetry && poetry config virtualenvs.create false
|
||||
WORKDIR /app
|
||||
RUN pip install playwright && playwright install chromium
|
||||
COPY ./pyproject.toml ./poetry.lock* /app/
|
||||
RUN poetry install --no-root --no-dev
|
||||
ADD src /app/src
|
||||
ADD bot.py /app/
|
||||
ENV HOST=0.0.0.0
|
||||
CMD ["python", "bot.py"]
|
||||
|
||||
# vim: ft=dockerfile
|
||||
|
@ -1,6 +1,7 @@
|
||||
FROM python:3.9
|
||||
RUN python3 -m pip install poetry && poetry config virtualenvs.create false
|
||||
WORKDIR /app
|
||||
RUN pip install playwright && playwright install chromium
|
||||
COPY ./pyproject.toml ./poetry.lock* ./bot.py /app/
|
||||
RUN poetry add nonebot-plugin-sentry && \
|
||||
sed '/nonebot.load_builtin_plugins()/a nonebot.load_plugin("nonebot_plugin_sentry")' -i bot.py
|
||||
@ -8,3 +9,5 @@ RUN poetry install --no-root --no-dev
|
||||
ADD src /app/src
|
||||
ENV HOST=0.0.0.0
|
||||
CMD ["python", "bot.py"]
|
||||
|
||||
# vim: set ft=dockerfile:
|
||||
|
@ -105,6 +105,7 @@ class Config(metaclass=Singleton):
|
||||
self.user_target.update({"subs": subs}, query)
|
||||
else:
|
||||
raise NoSuchUserException()
|
||||
self.update_send_cache()
|
||||
|
||||
def update_send_cache(self):
|
||||
res = {target_type: defaultdict(list) for target_type in supported_target_type}
|
||||
|
@ -63,6 +63,7 @@ class Render(metaclass=Singleton):
|
||||
async def render(self, url: str, viewport: Optional[dict] = None, target: Optional[str] = None,
|
||||
operation: Optional[Callable[[Page], Awaitable[None]]] = None) -> Optional[bytes]:
|
||||
retry_times = 0
|
||||
self.interval_log = ''
|
||||
while retry_times < 3:
|
||||
try:
|
||||
return await asyncio.wait_for(self.do_render(url, viewport, target, operation), 20)
|
||||
|
@ -1,24 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
|
||||
<meta name="keywords" content="明日方舟,明日方舟官网,明日方舟手游,二次元,明日方舟Arknights,魔物娘,战棋,策略,塔防,塔防RPG,Arknights,人外,Monster" />
|
||||
<meta name="description" content="《明日方舟》是一款魔物主题的策略手游。在游戏中,玩家将管理一艘满载“ 魔物干员”的方舟,为调查来源神秘的矿石灾难而踏上旅途。在这个宽广而危机四伏的世界中,你或许会看到废土中的城市废墟,或许会看到仿若幻境的亚人国度,或许会遭遇无法解读的神秘,或许参与无比残酷的战争。在有关幻想与异种生命的世界中,体验史诗与想象,情感与牵绊!" />
|
||||
<link rel="icon" href="data:;base64,=" />
|
||||
<title>公告</title>
|
||||
<link rel="stylesheet" href="../../assets/css/announcement.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="container">
|
||||
<div class="banner-image-container cover">
|
||||
<a class="cover-jumper" href="uniwebview://move?target=recruit&param1=NORM_19_0_4">
|
||||
<img class="banner-image" src="https://ak-fs.hypergryph.com/announce/images/20210623/e6f49aeb9547a2278678368a43b95b07.jpg" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
27
tests/platforms/arknights-detail-805
Normal file
27
tests/platforms/arknights-detail-805
Normal file
File diff suppressed because one or more lines are too long
@ -1,65 +1,56 @@
|
||||
{
|
||||
"focusAnnounceId": "677",
|
||||
"focusAnnounceId": "816",
|
||||
"announceList": [
|
||||
{
|
||||
"announceId": "677",
|
||||
"title": "联锁竞赛预告\n「荷谟伊智境」",
|
||||
"announceId": "807",
|
||||
"title": "【雪融之诺】\n限时寻访开启",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/677.html",
|
||||
"day": 28,
|
||||
"month": 6,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/807_1640060583.html",
|
||||
"day": 21,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "676",
|
||||
"title": "「制作组通讯」\n#12期",
|
||||
"announceId": "809",
|
||||
"title": "冰原信使系列\n新装限时上架",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/676.html",
|
||||
"day": 23,
|
||||
"month": 6,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/809_1640060505.html",
|
||||
"day": 21,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "810",
|
||||
"title": "寒武纪系列\n限时复刻上架",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/810_1640060511.html",
|
||||
"day": 21,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "806",
|
||||
"title": "跨年欢庆·回首\n限时寻访说明",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/806_1639379808.html",
|
||||
"day": 14,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "802",
|
||||
"title": "「制作组通讯」\n#15期",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/802_1638871766.html",
|
||||
"day": 8,
|
||||
"month": 12,
|
||||
"group": "SYSTEM"
|
||||
},
|
||||
{
|
||||
"announceId": "672",
|
||||
"title": "时代系列\n复刻限时上架",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/672.html",
|
||||
"day": 17,
|
||||
"month": 6,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "671",
|
||||
"title": "生命之地系列\n新装限时上架",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/671.html",
|
||||
"day": 17,
|
||||
"month": 6,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "670",
|
||||
"title": "【君影轻灵】\n复刻寻访开启",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/670.html",
|
||||
"day": 17,
|
||||
"month": 6,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "667",
|
||||
"title": "沃伦姆德的薄暮\n限时复刻开启",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/667.html",
|
||||
"day": 17,
|
||||
"month": 6,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "97",
|
||||
"title": "新人寻访特惠\n必得六星干员",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/97.html",
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/97_1606379786.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "ACTIVITY"
|
||||
@ -68,7 +59,7 @@
|
||||
"announceId": "95",
|
||||
"title": "通关特定关卡\n赠送专属时装",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/95.html",
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/95_1606379781.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "ACTIVITY"
|
||||
@ -77,7 +68,7 @@
|
||||
"announceId": "192",
|
||||
"title": "《明日方舟》\n公测开启说明",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/192.html",
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/192_1606379744.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "SYSTEM"
|
||||
@ -86,7 +77,7 @@
|
||||
"announceId": "98",
|
||||
"title": "《明日方舟》\n公平运营申明",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/98.html",
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/98_1638970453.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "SYSTEM"
|
||||
@ -95,7 +86,7 @@
|
||||
"announceId": "94",
|
||||
"title": "常驻活动介绍",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak-fs.hypergryph.com/announce/IOS/announcement/94.html",
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/94_1606379757.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "ACTIVITY"
|
||||
|
@ -1 +1,108 @@
|
||||
{"focusAnnounceId":"677","announceList":[{"announceId":"677","title":"联锁竞赛预告\n「荷谟伊智境」","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/677.html","day":28,"month":6,"group":"ACTIVITY"},{"announceId":"675","title":"特定干员\n限时出率上升","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/675.html","day":24,"month":6,"group":"ACTIVITY"},{"announceId":"676","title":"「制作组通讯」\n#12期","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/676.html","day":23,"month":6,"group":"SYSTEM"},{"announceId":"672","title":"时代系列\n复刻限时上架","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/672.html","day":17,"month":6,"group":"ACTIVITY"},{"announceId":"671","title":"生命之地系列\n新装限时上架","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/671.html","day":17,"month":6,"group":"ACTIVITY"},{"announceId":"670","title":"【君影轻灵】\n复刻寻访开启","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/670.html","day":17,"month":6,"group":"ACTIVITY"},{"announceId":"667","title":"沃伦姆德的薄暮\n限时复刻开启","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/667.html","day":17,"month":6,"group":"ACTIVITY"},{"announceId":"97","title":"新人寻访特惠\n必得六星干员","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/97.html","day":30,"month":4,"group":"ACTIVITY"},{"announceId":"95","title":"通关特定关卡\n赠送专属时装","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/95.html","day":30,"month":4,"group":"ACTIVITY"},{"announceId":"192","title":"《明日方舟》\n公测开启说明","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/192.html","day":30,"month":4,"group":"SYSTEM"},{"announceId":"98","title":"《明日方舟》\n公平运营申明","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/98.html","day":30,"month":4,"group":"SYSTEM"},{"announceId":"94","title":"常驻活动介绍","isWebUrl":true,"webUrl":"https://ak-fs.hypergryph.com/announce/IOS/announcement/94.html","day":30,"month":4,"group":"ACTIVITY"}],"extra":{"enable":false,"name":"额外活动"}}
|
||||
{
|
||||
"focusAnnounceId": "816",
|
||||
"announceList": [
|
||||
{
|
||||
"announceId": "805",
|
||||
"title": "「风雪过境」\n暨跨年活动开启",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/805_1640074952.html",
|
||||
"day": 21,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "807",
|
||||
"title": "【雪融之诺】\n限时寻访开启",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/807_1640060583.html",
|
||||
"day": 21,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "809",
|
||||
"title": "冰原信使系列\n新装限时上架",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/809_1640060505.html",
|
||||
"day": 21,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "810",
|
||||
"title": "寒武纪系列\n限时复刻上架",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/810_1640060511.html",
|
||||
"day": 21,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "806",
|
||||
"title": "跨年欢庆·回首\n限时寻访说明",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/806_1639379808.html",
|
||||
"day": 14,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "802",
|
||||
"title": "「制作组通讯」\n#15期",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/802_1638871766.html",
|
||||
"day": 8,
|
||||
"month": 12,
|
||||
"group": "SYSTEM"
|
||||
},
|
||||
{
|
||||
"announceId": "97",
|
||||
"title": "新人寻访特惠\n必得六星干员",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/97_1606379786.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "95",
|
||||
"title": "通关特定关卡\n赠送专属时装",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/95_1606379781.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "192",
|
||||
"title": "《明日方舟》\n公测开启说明",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/192_1606379744.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "SYSTEM"
|
||||
},
|
||||
{
|
||||
"announceId": "98",
|
||||
"title": "《明日方舟》\n公平运营申明",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/98_1638970453.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "SYSTEM"
|
||||
},
|
||||
{
|
||||
"announceId": "94",
|
||||
"title": "常驻活动介绍",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/94_1606379757.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "ACTIVITY"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"enable": false,
|
||||
"name": "额外活动"
|
||||
}
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ def monster_siren_list_1():
|
||||
@respx.mock
|
||||
async def test_fetch_new(arknights, dummy_user_subinfo, arknights_list_0, arknights_list_1, monster_siren_list_0, monster_siren_list_1):
|
||||
ak_list_router = respx.get("https://ak-conf.hypergryph.com/config/prod/announce_meta/IOS/announcement.meta.json")
|
||||
detail_router = respx.get("https://ak-fs.hypergryph.com/announce/IOS/announcement/675.html")
|
||||
detail_router = respx.get("https://ak.hycdn.cn/announce/IOS/announcement/805_1640074952.html")
|
||||
version_router = respx.get('https://ak-conf.hypergryph.com/config/prod/official/IOS/version')
|
||||
preannouncement_router = respx.get('https://ak-conf.hypergryph.com/config/prod/announce_meta/IOS/preannouncement.meta.json')
|
||||
monster_siren_router = respx.get("https://monster-siren.hypergryph.com/api/news")
|
||||
ak_list_router.mock(return_value=Response(200, json=arknights_list_0))
|
||||
detail_router.mock(return_value=Response(200, text=get_file('arknights-detail-675.html')))
|
||||
detail_router.mock(return_value=Response(200, text=get_file('arknights-detail-805')))
|
||||
version_router.mock(return_value=Response(200, json=get_json('arknights-version-0.json')))
|
||||
preannouncement_router.mock(return_value=Response(200, json=get_json('arknights-pre-0.json')))
|
||||
monster_siren_router.mock(return_value=Response(200, json=monster_siren_list_0))
|
||||
@ -60,6 +60,6 @@ async def test_fetch_new(arknights, dummy_user_subinfo, arknights_list_0, arknig
|
||||
assert(post.url == '')
|
||||
assert(post.target_name == '明日方舟游戏内公告')
|
||||
assert(len(post.pics) == 1)
|
||||
assert(post.pics == ['https://ak-fs.hypergryph.com/announce/images/20210623/e6f49aeb9547a2278678368a43b95b07.jpg'])
|
||||
# assert(post.pics == ['https://ak-fs.hypergryph.com/announce/images/20210623/e6f49aeb9547a2278678368a43b95b07.jpg'])
|
||||
print(res3[0][1])
|
||||
r = await post.generate_messages()
|
||||
|
Loading…
x
Reference in New Issue
Block a user