From cda9aae8a3faf489f25a58856296a123a1da896a Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Thu, 7 Jul 2022 22:02:33 +0800 Subject: [PATCH 01/17] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a6871a76..510bac59 100644 --- a/README.md +++ b/README.md @@ -243,6 +243,10 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__ ## 更新 +### 2022/7/7 + +* 微博热搜选择单条热搜时也会检测时效性 [@pull/891](https://github.com/HibiKier/zhenxun_bot/pull/891) + ### 2022/7/4 * 修复商品未设置限购时无法购买 From f05d4ec9317df70a7e659267ad8ff473738c0a64 Mon Sep 17 00:00:00 2001 From: dingshan Date: Fri, 5 Aug 2022 15:35:45 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B5=9B=E9=A9=AC?= =?UTF-8?q?=E5=A8=98=E9=87=8D=E8=BD=BD=E5=8D=A1=E6=B1=A0=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/draw_card/handles/base_handle.py | 1 + plugins/draw_card/handles/pretty_handle.py | 25 ++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/plugins/draw_card/handles/base_handle.py b/plugins/draw_card/handles/base_handle.py index 9e019884..526be07a 100644 --- a/plugins/draw_card/handles/base_handle.py +++ b/plugins/draw_card/handles/base_handle.py @@ -50,6 +50,7 @@ class UpEvent(BaseModel): start_time: Optional[datetime] # 开始时间 end_time: Optional[datetime] # 结束时间 up_char: List[UpChar] # up对象 + up_name: str = "" TC = TypeVar("TC", bound="BaseData") diff --git a/plugins/draw_card/handles/pretty_handle.py b/plugins/draw_card/handles/pretty_handle.py index da56bd64..f4147d5d 100644 --- a/plugins/draw_card/handles/pretty_handle.py +++ b/plugins/draw_card/handles/pretty_handle.py @@ -350,48 +350,52 @@ class PrettyHandle(BaseHandle[PrettyData]): char_img = "" card_img = "" up_chars = [] + up_chars_name = [] up_cards = [] + up_cards_name = [] soup = BeautifulSoup(result, "lxml") heads = soup.find_all("span", {"class": "mw-headline"}) for head in heads: - if "时间" in head.text: + if "时间" in head.text or "期间" in head.text: time = head.find_next("p").text.split("\n")[0] if "~" in time: start, end = time.split("~") start_time = dateparser.parse(start) end_time = dateparser.parse(end) elif "赛马娘" in head.text: - char_img = head.find_next("a", {"class": "image"}).find("img")[ + char_img = head.find_next("center").find("img")[ "src" ] lines = str(head.find_next("p").text).split("\n") chars = [ line for line in lines - if "★" in line and "(" in line and ")" in line + if "★" in line and "【" in line and "】" in line ] for char in chars: star = char.count("★") - name = re.split(r"[()]", char)[-2].strip() + name = re.split(r"[【】]", char)[-2].strip() up_chars.append( UpChar(name=name, star=star, limited=False, zoom=70) ) + up_chars_name.append(name) elif "支援卡" in head.text: - card_img = head.find_next("a", {"class": "image"}).find("img")[ + card_img = head.find_next("center").find("img")[ "src" ] lines = str(head.find_next("p").text).split("\n") cards = [ line for line in lines - if "R" in line and "(" in line and ")" in line + if "R" in line and "【" in line and "】" in line ] for card in cards: star = 3 if "SSR" in card else 2 if "SR" in card else 1 - name = re.split(r"[()]", card)[-2].strip() + name = re.split(r"[【】]", card)[-2].strip() up_cards.append( UpChar(name=name, star=star, limited=False, zoom=70) ) + up_cards_name.append(name) if start_time and end_time: if start_time <= datetime.now() <= end_time: self.UP_CHAR = UpEvent( @@ -400,6 +404,7 @@ class PrettyHandle(BaseHandle[PrettyData]): start_time=start_time, end_time=end_time, up_char=up_chars, + up_name=up_chars_name, ) self.UP_CARD = UpEvent( title=title, @@ -407,6 +412,7 @@ class PrettyHandle(BaseHandle[PrettyData]): start_time=start_time, end_time=end_time, up_char=up_cards, + up_name=up_cards_name, ) self.dump_up_char() logger.info(f"成功获取{self.game_name_cn}当前up信息...当前up池: {title}") @@ -418,9 +424,10 @@ class PrettyHandle(BaseHandle[PrettyData]): self.load_up_char() if self.UP_CHAR and self.UP_CARD: return Message( - Message.template("重载成功!\n当前UP池子:{}{:image}{:image}").format( - self.UP_CHAR.title, + Message.template("重载成功!\n当前UP池子:{}{:image}\n当前支援卡池子:{}{:image}").format( + self.UP_CHAR.up_name, self.UP_CHAR.pool_img, + self.UP_CARD.up_name, self.UP_CARD.pool_img, ) ) From 6151dfb1619e70550b15ddd7efbf48aa3c0b8083 Mon Sep 17 00:00:00 2001 From: dingshan Date: Fri, 5 Aug 2022 15:42:53 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B5=9B=E9=A9=AC?= =?UTF-8?q?=E5=A8=98=E9=87=8D=E8=BD=BD=E5=8D=A1=E6=B1=A0=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/draw_card/handles/base_handle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/draw_card/handles/base_handle.py b/plugins/draw_card/handles/base_handle.py index 526be07a..ddfc59af 100644 --- a/plugins/draw_card/handles/base_handle.py +++ b/plugins/draw_card/handles/base_handle.py @@ -50,7 +50,7 @@ class UpEvent(BaseModel): start_time: Optional[datetime] # 开始时间 end_time: Optional[datetime] # 结束时间 up_char: List[UpChar] # up对象 - up_name: str = "" + up_name: str = "" # up名称 TC = TypeVar("TC", bound="BaseData") From 3c120ce6020282e437bf78bf3d2e4c199d029bb4 Mon Sep 17 00:00:00 2001 From: dingshan Date: Fri, 5 Aug 2022 15:49:21 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=87=E6=B3=A8?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/draw_card/handles/pretty_handle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/draw_card/handles/pretty_handle.py b/plugins/draw_card/handles/pretty_handle.py index f4147d5d..4011e416 100644 --- a/plugins/draw_card/handles/pretty_handle.py +++ b/plugins/draw_card/handles/pretty_handle.py @@ -372,7 +372,7 @@ class PrettyHandle(BaseHandle[PrettyData]): for line in lines if "★" in line and "【" in line and "】" in line ] - for char in chars: + for char in set(chars): # list去重 star = char.count("★") name = re.split(r"[【】]", char)[-2].strip() up_chars.append( From ca78e32d97b6fccedd8692a7a30d910a91e9d169 Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Mon, 8 Aug 2022 04:23:05 +0800 Subject: [PATCH 05/17] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index cf3fe3db..4395ca54 100644 --- a/README.md +++ b/README.md @@ -247,6 +247,10 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ## 更新 +### 2022/8/8 + +* 修复赛马娘重载卡池失败的问题 [@pull/969](https://github.com/HibiKier/zhenxun_bot/pull/969) + ### 2022/8/3 * 修复 bili动态链接在投稿视频时URL和分割线连在一起 [@pull/951](https://github.com/HibiKier/zhenxun_bot/pull/961) From ddbebba6f16c432f5dbdee27941b1d8a8a2e472c Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Sun, 14 Aug 2022 21:18:29 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8Depic=E6=9C=AA=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=97=B6=E9=97=B4=E6=97=B6=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ plugins/epic/data_source.py | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4395ca54..35953798 100644 --- a/README.md +++ b/README.md @@ -247,6 +247,10 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ## 更新 +### 2022/8/14 + +* 修复epic未获取到时间时出错 + ### 2022/8/8 * 修复赛马娘重载卡池失败的问题 [@pull/969](https://github.com/HibiKier/zhenxun_bot/pull/969) diff --git a/plugins/epic/data_source.py b/plugins/epic/data_source.py index ba4f5dd8..cbdc48c1 100755 --- a/plugins/epic/data_source.py +++ b/plugins/epic/data_source.py @@ -96,12 +96,15 @@ async def get_epic_free(bot: Bot, type_event: str): if pair["key"] == "publisherName": game_pub = pair["value"] game_desp = game["description"] - end_date_iso = game["promotions"]["promotionalOffers"][0][ - "promotionalOffers" - ][0]["endDate"][:-1] - end_date = datetime.fromisoformat(end_date_iso).strftime( - "%b.%d %H:%M" - ) + try: + end_date_iso = game["promotions"]["promotionalOffers"][0][ + "promotionalOffers" + ][0]["endDate"][:-1] + end_date = datetime.fromisoformat(end_date_iso).strftime( + "%b.%d %H:%M" + ) + except IndexError: + end_date = '未知' # API 返回不包含游戏商店 URL,此处自行拼接,可能出现少数游戏 404 请反馈 if game.get("productSlug"): game_url = "https://store.epicgames.com/zh-CN/p/{}".format( From 0b4d37a0b6dd9639214174b9c93328d3784069a8 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Sun, 14 Aug 2022 21:31:57 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E4=B8=BB=E6=92=AD=E6=97=B6=E5=8A=A8=E6=80=81=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9A=84id=E6=98=AF=E7=9B=B4=E6=92=AD=E9=97=B4id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + plugins/bilibili_sub/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 35953798..400a30f2 100644 --- a/README.md +++ b/README.md @@ -250,6 +250,7 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ### 2022/8/14 * 修复epic未获取到时间时出错 +* 修复订阅主播时动态获取的id是直播间id ### 2022/8/8 diff --git a/plugins/bilibili_sub/__init__.py b/plugins/bilibili_sub/__init__.py index 989627e3..d05b5489 100755 --- a/plugins/bilibili_sub/__init__.py +++ b/plugins/bilibili_sub/__init__.py @@ -234,7 +234,7 @@ async def _(): rst = await get_sub_status(sub.sub_id, sub.sub_type) await send_sub_msg(rst, sub, bot) if sub.sub_type == "live": - rst = await get_sub_status(sub.sub_id, "up") + rst = await get_sub_status(sub.uid, "up") await send_sub_msg(rst, sub, bot) except Exception as e: logger.error(f"B站订阅推送发生错误 sub_id:{sub.sub_id if sub else 0} {type(e)}:{e}") From 27e78c162630c4de99fb61e35761bd741037037b Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Sun, 14 Aug 2022 22:11:36 +0800 Subject: [PATCH 08/17] update README.md --- README.md | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 400a30f2..9f39d83d 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,32 @@ __Docker 全量版(包含 真寻Bot PostgreSQL数据库 go-cqhttp webui等)_ **点击上方的 GitHub 徽标查看教程** PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能无法正常启动全量版容器** +## [爱发电](https://afdian.net/@HibiKier) +
+爱发电 以及 感谢投喂 + + +### 感谢名单 +(可以告诉我你的 __github__ 地址,我偷偷换掉0v|) +[爱发电用户_b9S4](https://afdian.net/u/3d8f30581a2911edba6d52540025c377) +[爱发电用户_c58s](https://afdian.net/u/a6ad8dda195e11ed9a4152540025c377) +[爱发电用户_eNr9](https://afdian.net/u/05fdb41c0c9a11ed814952540025c377) +[MangataAkihi](https://github.com/Sakuracio) +[炀](https://afdian.net/u/69b76e9ec77b11ec874f52540025c377) +[爱发电用户_Bc6j](https://afdian.net/u/8546be24f44111eca64052540025c377) +[大魔王](https://github.com/xipesoy) +[CopilotLaLaLa](https://github.com/CopilotLaLaLa) +[嘿小欧](https://afdian.net/u/daa4bec4f24911ec82e552540025c377) +[回忆的秋千](https://afdian.net/u/e315d9c6f14f11ecbeef52540025c377) +[十年くん](https://afdian.net/@ZXYX10) +[哇](https://afdian.net/u/9b266244f23911eca19052540025c377) +[yajiwa](https://github.com/yajiwa) +[爆金币](https://afdian.net/u/0d78879ef23711ecb22452540025c377) + + +
+ + ## 更新 ### 2022/8/14 @@ -277,7 +303,7 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 * 替换了cos和bt的url [@pull/951](https://github.com/HibiKier/zhenxun_bot/pull/951) * 发言记录统计添加日消息统计 [@pull/953](https://github.com/HibiKier/zhenxun_bot/pull/953) -### 2022/7/24 +### 2022/7/24 \[v0.1.6.2] * 订阅up动态提供直链 @@ -747,10 +773,6 @@ __..... 更多更新信息请查看文档__ ## Todo - [ ] web管理 -## 爱发电 - - - ## 感谢 [botuniverse / onebot](https://github.com/botuniverse/onebot) :超棒的机器人协议 [Mrs4s / go-cqhttp](https://github.com/Mrs4s/go-cqhttp) :cqhttp的golang实现,轻量、原生跨平台. From 51508182ef66d0343d5be0fb7e6b035c8021c9c2 Mon Sep 17 00:00:00 2001 From: shinianj <105840558+shinianj@users.noreply.github.com> Date: Tue, 16 Aug 2022 00:38:14 +0800 Subject: [PATCH 09/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f39d83d..b07ac1c3 100644 --- a/README.md +++ b/README.md @@ -262,7 +262,7 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 [CopilotLaLaLa](https://github.com/CopilotLaLaLa) [嘿小欧](https://afdian.net/u/daa4bec4f24911ec82e552540025c377) [回忆的秋千](https://afdian.net/u/e315d9c6f14f11ecbeef52540025c377) -[十年くん](https://afdian.net/@ZXYX10) +[十年くん](https://github.com/shinianj) [哇](https://afdian.net/u/9b266244f23911eca19052540025c377) [yajiwa](https://github.com/yajiwa) [爆金币](https://afdian.net/u/0d78879ef23711ecb22452540025c377) From a98bc42f1a37406eeb0e3d803d6864331dc2f276 Mon Sep 17 00:00:00 2001 From: LambdaYH Date: Tue, 23 Aug 2022 13:16:14 +0800 Subject: [PATCH 10/17] fix https://github.com/HibiKier/zhenxun_bot/issues/1026 --- plugins/word_bank/_model.py | 23 ++++++++++++++++------- plugins/word_bank/_rule.py | 2 -- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/plugins/word_bank/_model.py b/plugins/word_bank/_model.py index 2eec7b00..b53f0879 100644 --- a/plugins/word_bank/_model.py +++ b/plugins/word_bank/_model.py @@ -237,12 +237,21 @@ class WordBank(db.Model): if await query.where( ((cls.word_type == 0) | (cls.word_type == 3)) & (cls.problem == problem) ).gino.first(): - return query.where(cls.problem == problem) + return query.where( + ((cls.word_type == 0) | (cls.word_type == 3)) & (cls.problem == problem) + ) # 模糊匹配 - if await query.where( - (cls.word_type == 1) & (cls.problem.contains(problem)) - ).gino.first(): - return query.where(cls.problem.contains(problem)) + if await db.first( + db.text( + sql_text + + f" and word_type = 1 and :problem like '%' || problem || '%';" + ), + problem=problem, + ): + return ( + sql_text + + f" and word_type = 1 and :problem like '%' || problem || '%';" + ) # 正则匹配 if await db.first( db.text( @@ -253,7 +262,7 @@ class WordBank(db.Model): ): return ( sql_text - + f" and word_type = 2 and word_scope != 999 and '{problem}' ~ problem;" + + f" and word_type = 2 and word_scope != 999 and :problem ~ problem;" ) # if await db.first( # db.text(sql_text + f" and word_type = 1 and word_scope != 999 and '{problem}' ~ problem;") @@ -281,7 +290,7 @@ class WordBank(db.Model): query = await cls.check(event, problem, word_scope, word_type) if query is not None: if isinstance(query, str): - answer_list = await db.all(db.text(query)) + answer_list = await db.all(db.text(query), problem=problem) answer = random.choice(answer_list) return ( await cls._format2answer(problem, answer[7], answer[1], answer[2]) diff --git a/plugins/word_bank/_rule.py b/plugins/word_bank/_rule.py index 54498d6f..63f5b741 100644 --- a/plugins/word_bank/_rule.py +++ b/plugins/word_bank/_rule.py @@ -27,8 +27,6 @@ async def check(event: MessageEvent, state: T_State) -> bool: for seg in event.message: if seg.type == 'at': temp += f"[at:{seg.data['qq']}]" - elif isinstance(seg, str): - temp += seg elif seg.type == 'text': temp += seg.data["text"] problem = temp From 38160065cc72cc2233bf967f8e06a57e3a191484 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Tue, 23 Aug 2022 23:02:06 +0800 Subject: [PATCH 11/17] UPDATE README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e72dc67d..766a4359 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,10 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ## 更新 +### 2022/8/23 + +* 修了下模糊匹配 issue#1026 [@pull/1026](https://github.com/HibiKier/zhenxun_bot/pull/1026) + ### 2022/8/22 * 修复首次安装时词条旧表出错(因为根本就没有这张表!) From 0756d39ac542854bd9cb6db41aaf09c0cdd456d2 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Fri, 26 Aug 2022 19:26:09 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BE=A4=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E6=97=A0=E6=B3=95=E6=B7=BB=E5=8A=A0=E8=AF=8D?= =?UTF-8?q?=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ plugins/word_bank/word_handle.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 766a4359..30d2f469 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,10 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ## 更新 +### 2022/8/26 + +* 修复群管理员无法添加词条 + ### 2022/8/23 * 修了下模糊匹配 issue#1026 [@pull/1026](https://github.com/HibiKier/zhenxun_bot/pull/1026) diff --git a/plugins/word_bank/word_handle.py b/plugins/word_bank/word_handle.py index 8aa44b54..401562c7 100644 --- a/plugins/word_bank/word_handle.py +++ b/plugins/word_bank/word_handle.py @@ -93,7 +93,7 @@ async def _( state: T_State, reg_group: Tuple[Any, ...] = RegexGroup(), ): - if str(event.user_id) not in bot.config.superusers: + if isinstance(event, PrivateMessageEvent) and str(event.user_id) not in bot.config.superusers: await add_word.finish('权限不足捏') word_scope, word_type, problem, answer = reg_group if ( From e42521f0a3e53b707fa60eae00fef9e17874b73c Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Fri, 26 Aug 2022 19:39:23 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=8D=E6=9D=A1?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D"=E9=97=AE"=E5=89=8D=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + plugins/word_bank/word_handle.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30d2f469..a330c641 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,7 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ### 2022/8/26 * 修复群管理员无法添加词条 +* 修复词条关键词"问"前空格问题 ### 2022/8/23 diff --git a/plugins/word_bank/word_handle.py b/plugins/word_bank/word_handle.py index 401562c7..5d6158ed 100644 --- a/plugins/word_bank/word_handle.py +++ b/plugins/word_bank/word_handle.py @@ -130,8 +130,9 @@ async def _( problem = temp break problem = unescape(problem) - index = len((word_scope or "") + "添加词条" + (word_type or "") + problem) + 1 - event.message[0] = event.message[0].data["text"][index + 1 :].strip() + # index = len((word_scope or "") + "添加词条" + (word_type or "") + problem) + 1 + # event.message[0] = event.message[0].data["text"][index + 1 :].strip() + event.message[0] = event.message[0].data["text"].split('答', maxsplit=1)[-1].strip() state["word_scope"] = word_scope state["word_type"] = word_type state["problem"] = problem From 51fc4cbb6aa18b20810dccb6ea283479201cf95a Mon Sep 17 00:00:00 2001 From: zyj2134 Date: Fri, 26 Aug 2022 22:49:51 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=8F=8C=E5=80=8D=E5=90=8E=EF=BC=8C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=AE=B0=E5=BD=95=E8=8E=B7=E5=BE=97=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E5=8F=984=E5=80=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/sign_in/group_user_checkin.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/plugins/sign_in/group_user_checkin.py b/plugins/sign_in/group_user_checkin.py index 52ec4c6f..87174d34 100755 --- a/plugins/sign_in/group_user_checkin.py +++ b/plugins/sign_in/group_user_checkin.py @@ -81,19 +81,15 @@ async def _handle_check_in( await BagUser.add_gold(user_qq, group, gold) await BagUser.add_property(user_qq, group, gift) gift += ' + 1' + + logger.info( + f"(USER {user.user_qq}, GROUP {user.group_id})" + f" CHECKED IN successfully. score: {user.impression:.2f} " + f"(+{impression_added:.2f}).获取金币:{gold + gift if gift == 'gold' else gold}" + ) if critx2 + add_probability > 0.97 or critx2 < specify_probability: - logger.info( - f"(USER {user.user_qq}, GROUP {user.group_id})" - f" CHECKED IN successfully. score: {user.impression:.2f} " - f"(+{impression_added * 2:.2f}).获取金币:{gold + gift if gift == 'gold' else gold}" - ) return await get_card(user, nickname, impression_added, gold, gift, True) else: - logger.info( - f"(USER {user.user_qq}, GROUP {user.group_id})" - f" CHECKED IN successfully. score: {user.impression:.2f} " - f"(+{impression_added:.2f}).获取金币:{gold + gift if gift == 'gold' else gold}" - ) return await get_card(user, nickname, impression_added, gold, gift) From 749f475f2c210146be6d6dd6d058e7f358a7d6c4 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Sat, 27 Aug 2022 18:25:30 +0800 Subject: [PATCH 15/17] UPDATE README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a330c641..2bd01bcb 100644 --- a/README.md +++ b/README.md @@ -252,6 +252,8 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ### 感谢名单 (可以告诉我你的 __github__ 地址,我偷偷换掉0v|) +[腊条](https://afdian.net/u/f739c4d69eca11eba94b52540025c377) +[ze roller](https://afdian.net/u/0e599e96257211ed805152540025c377) [爱发电用户_4jrf](https://afdian.net/u/6b2cdcc817c611ed949152540025c377) [爱发电用户_TBsd](https://afdian.net/u/db638b60217911ed9efd52540025c377) [烟寒若雨](https://afdian.net/u/067bd2161eec11eda62b52540025c377) @@ -277,6 +279,10 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ## 更新 +### 2022/8/27 + +* 修复签到积分双倍后,日志记录获得积分变4倍问题 [@pull/1044](https://github.com/HibiKier/zhenxun_bot/pull/1044) + ### 2022/8/26 * 修复群管理员无法添加词条 From bda9133ed67ddb28cc27503913f579f126dd59ec Mon Sep 17 00:00:00 2001 From: unknwonsno Date: Wed, 31 Aug 2022 22:22:00 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E5=8E=9F=E7=A5=9E=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=A2=9E=E5=8A=A0=E9=A1=BB=E5=BC=A5=E5=9C=B0?= =?UTF-8?q?=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../query_user/query_role/data_source.py | 1 + .../query_user/query_role/draw_image.py | 98 ++++++++++++------- 2 files changed, 63 insertions(+), 36 deletions(-) diff --git a/plugins/genshin/query_user/query_role/data_source.py b/plugins/genshin/query_user/query_role/data_source.py index 1aa5ad20..01b6fb70 100644 --- a/plugins/genshin/query_user/query_role/data_source.py +++ b/plugins/genshin/query_user/query_role/data_source.py @@ -195,6 +195,7 @@ def parsed_data( "magic_chest_number": data["stats"]["magic_chest_number"], # 奇馈宝箱 "common_chest_number": data["stats"]["common_chest_number"], # 普通宝箱 "electroculus_number": data["stats"]["electroculus_number"], # 雷神瞳已收集 + "dendroculus_number": data["stats"]["dendroculus_number"], # 草神瞳已收集 } world_data_dict = {} for world in data["world_explorations"]: diff --git a/plugins/genshin/query_user/query_role/draw_image.py b/plugins/genshin/query_user/query_role/draw_image.py index 31a3d07b..6bea3866 100644 --- a/plugins/genshin/query_user/query_role/draw_image.py +++ b/plugins/genshin/query_user/query_role/draw_image.py @@ -129,7 +129,7 @@ def get_user_data_image( """ if mys_data: nickname = [x["nickname"] for x in mys_data if x["game_id"] == 2][0] - region = BuildImage(1440, 450, color="#E3DBD1", font="HYWenHei-85W.ttf") + region = BuildImage(1440, 560, color="#E3DBD1", font="HYWenHei-85W.ttf") region.circle_corner(30) uname_img = BuildImage( 0, @@ -163,36 +163,42 @@ def get_user_data_image( / random.choice(os.listdir(image_path / "chars_ava")), ) ava_bk.paste(ava_img, (12, 16), alpha=True) - region.paste(uname_img, (int(170 + uid_img.w / 2 - uname_img.w / 2), 305), True) - region.paste(uid_img, (170, 355), True) - region.paste(ava_bk, (int(550 / 2 - ava_bk.w / 2), 40), True) + region.paste(uname_img, (int(170 + uid_img.w / 2 - uname_img.w / 2), 365), True) + region.paste(uid_img, (170, 415), True) + region.paste(ava_bk, (int(550 / 2 - ava_bk.w / 2), 100), True) data_img = BuildImage( - 800, 400, color="#E3DBD1", font="HYWenHei-85W.ttf", font_size=40 + 800, 510, color="#E3DBD1", font="HYWenHei-85W.ttf", font_size=40 ) _height = 0 keys = [ - ["活跃天数", "成就达成", "获得角色", "深境螺旋"], - ["华丽宝箱", "珍贵宝箱", "精致宝箱", "普通宝箱"], - ["奇馈宝箱", "风神瞳", "岩神瞳", "雷神瞳"], + ["活跃天数", "成就达成", "获得角色", "解锁传送"], + ["风神瞳", "岩神瞳", "雷神瞳", "草神瞳"], + ["解锁秘境", "深境螺旋", "华丽宝箱", "珍贵宝箱"], + ["精致宝箱", "普通宝箱", "奇馈宝箱",], ] values = [ [ role_data["active_day_number"], role_data["achievement_number"], role_data["avatar_number"], - role_data["spiral_abyss"], + role_data["way_point_number"], ], [ - role_data["luxurious_chest_number"], - role_data["precious_chest_number"], - role_data["exquisite_chest_number"], - role_data["common_chest_number"], - ], - [ - role_data["magic_chest_number"], role_data["anemoculus_number"], role_data["geoculus_number"], role_data["electroculus_number"], + role_data["dendroculus_number"], + ], + [ + role_data["domain_number"], + role_data["spiral_abyss"], + role_data["luxurious_chest_number"], + role_data["precious_chest_number"], + ], + [ + role_data["exquisite_chest_number"], + role_data["common_chest_number"], + role_data["magic_chest_number"], ], ] for key, value in zip(keys, values): @@ -215,7 +221,7 @@ def get_user_data_image( ) tmp_.text((0, 0), str(v), center_type="by_width") tmp_.paste(t_, (0, 50), True, "by_width") - _tmp_data_img.paste(tmp_, (_width if len(key) > 3 else _width + 15, 0)) + _tmp_data_img.paste(tmp_, ((_width + 15) if keys.index(key) == 1 else _width, 0)) _width += 200 data_img.paste(_tmp_data_img, (0, _height)) _height += _tmp_data_img.h - 70 @@ -228,7 +234,7 @@ def get_home_data_image(home_data_list: List[Dict]) -> BuildImage: 画出家园数据 :param home_data_list: 家园列表 """ - h = 130 + 300 * 4 + h = 130 + 340 * 4 region = BuildImage( 550, h, color="#E3DBD1", font="HYWenHei-85W.ttf", font_size=40 ) @@ -287,7 +293,7 @@ def get_home_data_image(home_data_list: List[Dict]) -> BuildImage: x.paste(black_img, alpha=True, center_type="center") x.circle_corner(50) region.paste(x, (0, height), True, "by_width") - height += 300 + height += 340 return region @@ -299,7 +305,7 @@ def get_country_data_image(world_data_dict: Dict) -> BuildImage: # 层岩巨渊 和 地下矿区 算一个 region = BuildImage(790, 267 * (len(world_data_dict) - 1), color="#F9F6F2") height = 0 - for country in ["蒙德", "龙脊雪山", "璃月", "层岩巨渊", "稻妻", "渊下宫"]: + for country in ["蒙德", "龙脊雪山", "璃月", "层岩巨渊", "稻妻", "渊下宫", "须弥"]: if not world_data_dict.get(country): continue x = BuildImage(790, 250, color="#3A4467") @@ -311,15 +317,15 @@ def get_country_data_image(world_data_dict: Dict) -> BuildImage: ) content_bk.paste(logo, (50, 0), True, "by_height") if country in ["蒙德", "璃月"]: - content_bk.text((300, 40), "探索", fill=(239, 211, 114)) + content_bk.text((300, 40), "蒙德探索" if country == "蒙德" else "璃月探索", fill=(239, 211, 114)) content_bk.text( - (450, 40), + (500, 40), f"{world_data_dict[country]['exploration_percentage'] / 10}%", fill=(255, 255, 255), ) - content_bk.text((300, 120), "声望", fill=(239, 211, 114)) + content_bk.text((300, 120), "蒙德声望" if country == "蒙德" else "璃月声望", fill=(239, 211, 114)) content_bk.text( - (450, 120), + (500, 120), f"Lv.{world_data_dict[country]['level']}", fill=(255, 255, 255), ) @@ -344,45 +350,65 @@ def get_country_data_image(world_data_dict: Dict) -> BuildImage: fill=(255, 255, 255), ) elif country in ["龙脊雪山"]: - content_bk.text((300, 40), "探索", fill=(239, 211, 114)) + content_bk.text((300, 40), "雪山探索", fill=(239, 211, 114)) content_bk.text( - (450, 40), + (500, 40), f"{world_data_dict[country]['exploration_percentage'] / 10}%", fill=(255, 255, 255), ) - content_bk.text((300, 120), "供奉", fill=(239, 211, 114)) + content_bk.text((300, 120), "忍冬之树", fill=(239, 211, 114)) content_bk.text( - (450, 120), + (500, 120), f"Lv.{world_data_dict[country]['offerings'][0]['level']}", fill=(255, 255, 255), ) elif country in ["稻妻"]: - content_bk.text((300, 20), "探索", fill=(239, 211, 114)) + content_bk.text((300, 20), "稻妻探索", fill=(239, 211, 114)) content_bk.text( - (450, 20), + (500, 20), f"{world_data_dict[country]['exploration_percentage'] / 10}%", fill=(255, 255, 255), ) - content_bk.text((300, 85), "声望", fill=(239, 211, 114)) + content_bk.text((300, 85), "稻妻声望", fill=(239, 211, 114)) content_bk.text( - (450, 85), + (500, 85), f"Lv.{world_data_dict[country]['level']}", fill=(255, 255, 255), ) - content_bk.text((300, 150), "神樱", fill=(239, 211, 114)) + content_bk.text((300, 150), "神樱眷顾", fill=(239, 211, 114)) content_bk.text( - (450, 150), + (500, 150), f"Lv.{world_data_dict[country]['offerings'][0]['level']}", fill=(255, 255, 255), ) elif country in ["渊下宫"]: - content_bk.text((300, 0), "探索", fill=(239, 211, 114), center_type="by_height") + content_bk.text((300, 0), "渊下宫探索", fill=(239, 211, 114), center_type="by_height") content_bk.text( - (450, 20), + (530, 20), f"{world_data_dict[country]['exploration_percentage'] / 10}%", fill=(255, 255, 255), center_type="by_height", ) + elif country in ["须弥"]: + content_bk.text((300, 20), "须弥探索", fill=(239, 211, 114)) + content_bk.text( + (500, 20), + f"{world_data_dict[country]['exploration_percentage'] / 10}%", + fill=(255, 255, 255), + ) + content_bk.text((300, 85), "须弥声望", fill=(239, 211, 114)) + content_bk.text( + (500, 85), + f"Lv.{world_data_dict[country]['level']}", + fill=(255, 255, 255), + ) + content_bk.text((300, 150), "梦之树", fill=(239, 211, 114)) + content_bk.text( + (500, 150), + f"Lv.{world_data_dict[country]['offerings'][0]['level']}", + fill=(255, 255, 255), + ) + x.paste(tmp_bk, alpha=True, center_type="center") x.paste(content_bk, alpha=True, center_type="center") x.circle_corner(20) From 4e551bec0d1dd672c402dfd64aed7f66a68a5991 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Sat, 3 Sep 2022 16:16:33 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=8D=E6=9D=A1?= =?UTF-8?q?=E5=90=AB=E6=9C=89CQ=E5=9B=9E=E7=AD=94=E7=9A=84=E6=A8=A1?= =?UTF-8?q?=E7=B3=8A=E5=8C=B9=E9=85=8D=E6=97=A0=E6=B3=95=E8=A2=AB=E8=A7=A3?= =?UTF-8?q?=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ plugins/word_bank/_model.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2bd01bcb..2186ef24 100644 --- a/README.md +++ b/README.md @@ -279,6 +279,11 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ## 更新 +### 2022/9/3 + +* 原神玩家查询增加须弥地区 [@pull/1053](https://github.com/HibiKier/zhenxun_bot/pull/1053) +* 修复词条含有CQ回答的模糊匹配无法被解析 + ### 2022/8/27 * 修复签到积分双倍后,日志记录获得积分变4倍问题 [@pull/1044](https://github.com/HibiKier/zhenxun_bot/pull/1044) diff --git a/plugins/word_bank/_model.py b/plugins/word_bank/_model.py index b53f0879..2e6557be 100644 --- a/plugins/word_bank/_model.py +++ b/plugins/word_bank/_model.py @@ -293,7 +293,7 @@ class WordBank(db.Model): answer_list = await db.all(db.text(query), problem=problem) answer = random.choice(answer_list) return ( - await cls._format2answer(problem, answer[7], answer[1], answer[2]) + await cls._format2answer(answer[6], answer[7], answer[1], answer[2]) if answer.placeholder else answer.answer )