From 40111261edfb94304c586d81dfb6b6ceb20f9b95 Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Sun, 16 Jan 2022 14:54:16 +0800 Subject: [PATCH 1/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 064ed779..6765bfbb 100644 --- a/README.md +++ b/README.md @@ -240,7 +240,7 @@ python bot.py * “send_success_msg”(发送成功的交互信息->即:使用道具 {name} {num} 次成功) * “_max_num_limit”(该道具单次使用的最多个数,默认1) -### 2021/1/5 \[v0.0.8.3] +### 2021/1/5 \[v0.0.8.2] * 提供金币消费hook,可在plugins2settings.yaml中配置该功能需要消费的金币 * 商店插件将作为内置插件移动至basic_plugins From b1ca7930bbfbe158369a7acd01040898caf25532 Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Sun, 16 Jan 2022 14:54:31 +0800 Subject: [PATCH 2/8] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 6765bfbb..10feec83 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,6 @@ ## 来点优点? 一.作为bot: * 实现了许多功能,且提供了大量功能管理命令 - * __..... 更多详细请通过`传送门`查看文档!__ - -二.作为框架?: * 通过Config配置项将所有插件配置统计保存至config.yaml,利于统一用户修改 * 方便增删插件,原生nonebot2 matcher,不需要额外修改,仅仅通过简单的配置属性就可以生成`帮助图片`和`帮助信息` * 提供了cd,阻塞,每日次数等限制,仅仅通过简单的属性就可以生成一个限制,例如:`__plugin_cd_limit__` From 5d9ab40e3569c1d3381f6cf6189b4bc01d3da91d Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Sun, 16 Jan 2022 15:00:16 +0800 Subject: [PATCH 3/8] Update __version__ --- __version__ | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__version__ b/__version__ index 9665f943..0facde81 100644 --- a/__version__ +++ b/__version__ @@ -1 +1 @@ -__version__: v0.0.8.1 +__version__: v0.0.9.0 From 0163fc1d884435bf5e48dbd943da3130e751d276 Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Sun, 16 Jan 2022 15:16:19 +0800 Subject: [PATCH 4/8] Update draw_image.py --- plugins/genshin/query_user/query_role/draw_image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/genshin/query_user/query_role/draw_image.py b/plugins/genshin/query_user/query_role/draw_image.py index c41aaff8..4d4c1e4f 100644 --- a/plugins/genshin/query_user/query_role/draw_image.py +++ b/plugins/genshin/query_user/query_role/draw_image.py @@ -238,7 +238,7 @@ def get_home_data_image(home_data_list: List[Dict]) -> BuildImage: (0, 30), f'尘歌壶 Lv.{home_data_list[0]["level"]}', center_type="by_width" ) region.text( - (0, 980), f'仙力: {home_data_list[0]["comfort_num"]}', center_type="by_width" + (0, region.h - 70), f'仙力: {home_data_list[0]["comfort_num"]}', center_type="by_width" ) except (IndexError, KeyError): region.text((0, 30), f"尘歌壶 Lv.0", center_type="by_width") From 8022ae1fb14104bef1281127a641542bf0467af7 Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Sun, 16 Jan 2022 15:20:48 +0800 Subject: [PATCH 5/8] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 10feec83..5a03317e 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,9 @@ ## 真寻的帮助 请对真寻说: '真寻帮助' or '管理员帮助' or '超级用户帮助' or '真寻帮助 指令' +## 普通帮助图片 +![x](https://github.com/HibiKier/zhenxun_bot/blob/0.0.8.2/docs_image/3238573864-836268675-E2FFBB2AC143EAF4DDDF150438508721.png) + ## 提供符合真寻标准的插件仓库 [AkashiCoin/nonebot_plugins_zhenxun_bot](https://github.com/AkashiCoin/nonebot_plugins_zhenxun_bot) From 5ae41e1d382f712abd3f97260adb0658bdc5badd Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Sun, 16 Jan 2022 18:37:14 +0800 Subject: [PATCH 6/8] Update __init__.py --- plugins/dialogue/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/dialogue/__init__.py b/plugins/dialogue/__init__.py index a57bbdaa..58d85b5f 100755 --- a/plugins/dialogue/__init__.py +++ b/plugins/dialogue/__init__.py @@ -133,7 +133,7 @@ async def _(bot: Bot, event: MessageEvent, state: T_State): user_id = 0 if is_number(msg[1]): group_id = int(msg[1]) - text = msg[2] + text = " ".join(msg[2:]) else: await reply.finish("群号错误...", at_sender=True) else: From b6e3240df965d0256a64faff0f320c263dee191a Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Sun, 16 Jan 2022 19:22:03 +0800 Subject: [PATCH 7/8] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 5a03317e..844e7a91 100644 --- a/README.md +++ b/README.md @@ -217,6 +217,11 @@ python bot.py ``` +## 使用Docker +__Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__ +#### GitHub:[Sakuracio/zxenv](https://github.com/Sakuracio/zxenv) +#### DockerHub:[hibikier/zhenxun_bot](https://hub.docker.com/r/hibikier/zhenxun_bot) + ## 更新 From 95ad533b87e650f80e6fa115e586a7ffac0e63c3 Mon Sep 17 00:00:00 2001 From: SAGIRI-kawaii Date: Mon, 24 Jan 2022 23:52:57 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BC=98=E5=8C=96BuildImage.circle()?= =?UTF-8?q?=E9=94=AF=E9=BD=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/image_utils.py | 55 +++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/utils/image_utils.py b/utils/image_utils.py index a8a23e98..55482f68 100755 --- a/utils/image_utils.py +++ b/utils/image_utils.py @@ -838,28 +838,41 @@ class BuildImage: """ await self.loop.run_in_executor(None, self.circle) + def draw_ellipse(self, image, bounds, width=1, outline='white', antialias=4): + """ + Improved ellipse drawing function, based on PIL.ImageDraw. + """ + + # Use a single channel image (mode='L') as mask. + # The size of the mask can be increased relative to the imput image + # to get smoother looking results. + mask = Image.new( + size=[int(dim * antialias) for dim in image.size], + mode='L', color='black') + draw = ImageDraw.Draw(mask) + + # draw outer shape in white (color) and inner shape in black (transparent) + for offset, fill in (width / -2.0, 'black'), (width / 2.0, 'white'): + left, top = [(value + offset) * antialias for value in bounds[:2]] + right, bottom = [(value - offset) * antialias for value in bounds[2:]] + draw.ellipse([left, top, right, bottom], fill=fill) + + # downsample the mask using PIL.Image.LANCZOS + # (a high-quality downsampling filter). + mask = mask.resize(image.size, Image.LANCZOS) + + # paste outline color to input image through the mask + image.putalpha(mask) + + # def circle(self): - """ - 说明: - 将 BuildImage 图片变为圆形 - """ - self.convert("RGBA") - r2 = min(self.w, self.h) - if self.w != self.h: - self.resize(w=r2, h=r2) - r3 = int(r2 / 2) - imb = Image.new("RGBA", (r3 * 2, r3 * 2), (255, 255, 255, 0)) - pim_a = self.markImg.load() # 像素的访问对象 - pim_b = imb.load() - r = float(r2 / 2) - for i in range(r2): - for j in range(r2): - lx = abs(i - r) # 到圆心距离的横坐标 - ly = abs(j - r) # 到圆心距离的纵坐标 - l_ = (pow(lx, 2) + pow(ly, 2)) ** 0.5 # 三角函数 半径 - if l_ < r3: - pim_b[i - (r - r3), j - (r - r3)] = pim_a[i, j] - self.markImg = imb + self.markImg.convert("RGBA") + size = self.markImg.size + r2 = min(size[0], size[1]) + if size[0] != size[1]: + self.markImg = self.markImg.resize((r2, r2), Image.ANTIALIAS) + ellipse_box = [0, 0, r2 - 2, r2 - 2] + self.draw_ellipse(self.markImg, ellipse_box, width=1) async def acircle_corner(self, radii: int = 30): """