From 0a94bb3fc18cb2e50d881bdd14d418a9c9795052 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:02:21 +0800 Subject: [PATCH 01/85] =?UTF-8?q?=E5=B0=8F=E9=80=97=E6=AF=94=E8=87=AA?= =?UTF-8?q?=E7=94=A8=E6=8F=92=E4=BB=B6=20=E9=93=BE=E6=8E=A5=E8=B5=B0?= =?UTF-8?q?=E7=9A=84=E5=86=85=E7=BD=91=20=E9=9C=80=E8=A6=81=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E6=9B=BF=E6=8D=A2=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/R18.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 apps/R18.js diff --git a/apps/R18.js b/apps/R18.js new file mode 100644 index 0000000..3c62186 --- /dev/null +++ b/apps/R18.js @@ -0,0 +1,36 @@ +import { getFunctionData } from '../utils/getdate.js' +import fetch from 'node-fetch'; + +export class example extends plugin { + constructor() { + super({ + name: '[鸢尾花插件]三次元', + dsc: '三次元', + event: 'message', + priority: 5000, + rule: [ + { + reg: '^#?(三次元)$', + fnc: '三次元' + }, + ] + }); + } + + + + + + async 摸鱼日历 (e) { + let fetchUrl = await fetch(moyuapiUrl).catch(err => logger.error(err)); + let imgUrl = await fetchUrl.json(); + imgUrl = await imgUrl.url; + + e.reply([segment.image(imgUrl)]); + + return true + } + +} + +const moyuapiUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 \ No newline at end of file -- Gitee From e7b50c132b34bb388e8b2c793e7f4c9c6fd76582 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:17:02 +0800 Subject: [PATCH 02/85] changes --- apps/R18.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/R18.js b/apps/R18.js index 3c62186..ca3a9a7 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -1,4 +1,3 @@ -import { getFunctionData } from '../utils/getdate.js' import fetch from 'node-fetch'; export class example extends plugin { -- Gitee From b33f6e21b0c3deea85ceca8147c6fbb6170a27c8 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:20:13 +0800 Subject: [PATCH 03/85] changes --- apps/R18.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/R18.js b/apps/R18.js index ca3a9a7..ae0a619 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -20,16 +20,16 @@ export class example extends plugin { - async 摸鱼日历 (e) { - let fetchUrl = await fetch(moyuapiUrl).catch(err => logger.error(err)); - let imgUrl = await fetchUrl.json(); - imgUrl = await imgUrl.url; + async 三次元 (e) { + + e.reply([segment.image(newsimageUrl)]); + + return true + } + + } - e.reply([segment.image(imgUrl)]); - return true - } -} -const moyuapiUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 \ No newline at end of file +const newsimageUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 \ No newline at end of file -- Gitee From 2b81a7cf18bc13fb92544c10973ff86e18b64153 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:24:18 +0800 Subject: [PATCH 04/85] changes --- apps/R18.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/R18.js b/apps/R18.js index ae0a619..56fa6f9 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -32,4 +32,4 @@ export class example extends plugin { -const newsimageUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 \ No newline at end of file +const newsimageUrl = Buffer.from('https://ap.atxrom.com/r18');// 三次元接口地址 自己用 -- Gitee From bf10f3d3b1f6313364d9b4ee1b2de7d19555a5b3 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:29:07 +0800 Subject: [PATCH 05/85] changes --- apps/R18.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/apps/R18.js b/apps/R18.js index 56fa6f9..3338741 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -15,21 +15,24 @@ export class example extends plugin { ] }); } + + async 摸鱼日历 (e) { - async 三次元 (e) { - - e.reply([segment.image(newsimageUrl)]); - - return true - } - - } - - - + // 判断是否为 Base64 图片 + if (imageUrl.startsWith('data:image/') && imageUrl.includes(';base64,')) { + // 如果是 Base64 图片 也发不出去 -const newsimageUrl = Buffer.from('https://ap.atxrom.com/r18');// 三次元接口地址 自己用 + e.reply([segment.image(imageUrl)]) // 直接发送 Base64 图片 + } else { + // 如果不是 Base64 图片 + e.reply([segment.image(imageUrl)]) // 直接发送普通图片 + } + + return true +} +} + const imageUrl = Buffer.from('https://ap.atxrom.com/r18');// 三次元接口地址 自己用 \ No newline at end of file -- Gitee From e13971a9ef40d1f7d31bb766fa1d9ee2caf04549 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:30:10 +0800 Subject: [PATCH 06/85] changes --- apps/R18.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/R18.js b/apps/R18.js index 3338741..27a3ce9 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -35,4 +35,4 @@ export class example extends plugin { return true } } - const imageUrl = Buffer.from('https://ap.atxrom.com/r18');// 三次元接口地址 自己用 \ No newline at end of file + const imageUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 \ No newline at end of file -- Gitee From e3bd075ca43876dfef683adeaa76412cbc3d6ad4 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:31:20 +0800 Subject: [PATCH 07/85] c --- apps/R18.js | 66 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/apps/R18.js b/apps/R18.js index 27a3ce9..d3e6c40 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -1,38 +1,64 @@ -import fetch from 'node-fetch'; +import { getFunctionData } from '../utils/getdate.js' export class example extends plugin { constructor() { super({ - name: '[鸢尾花插件]三次元', - dsc: '三次元', + name: '[鸢尾花插件]今日新闻', + dsc: '获取每日60s新闻', event: 'message', priority: 5000, rule: [ { - reg: '^#?(三次元)$', - fnc: '三次元' - }, + reg: '^#?(60s日报|今日新闻)$', + fnc: '今日新闻' + } ] }); - } - + this.task = { + cron: this.newsConfig.time, + name: '推送今日新闻', + fnc: () => this.推送今日新闻(), + log: false}, + Object.defineProperty(this.task, 'log', { get: () => false }) + } + + get newsConfig () { return getFunctionData('push', 'setpush', '今日新闻') } + + + async 推送今日新闻 () { + try { + // 检查是否启用自动推送 + if (!this.newsConfig.isAutoPush) { + logger.info(`[今日新闻]自动推送未启用。`); + return false; + } + logger.info(`[今日新闻]开始推送……`); + for (let i = 0; i < this.newsConfig.groupList.length; i++) { + // 添加延迟以防止消息发送过快 + setTimeout(async () => { + const group = Bot.pickGroup(this.newsConfig.groupList[i]); + logger.info(`[今日新闻]正在向群组 ${group} 推送新闻。`); + await group.sendMsg([segment.image(newsimageUrl)]); + logger.info(`[今日新闻]新闻已成功推送到群组 ${group}。`); + }, i * 1000); + } + logger.info(`[今日新闻]推送完成。`); + return true; + } catch (error) { + logger.error(`[今日新闻]推送过程中出现错误: ${error}`); + } +} - async 摸鱼日历 (e) { + async 今日新闻 (e) { - // 判断是否为 Base64 图片 - if (imageUrl.startsWith('data:image/') && imageUrl.includes(';base64,')) { - // 如果是 Base64 图片 也发不出去 + e.reply([segment.image(newsimageUrl)]); - e.reply([segment.image(imageUrl)]) // 直接发送 Base64 图片 - } else { - // 如果不是 Base64 图片 - e.reply([segment.image(imageUrl)]) // 直接发送普通图片 + return true } - - return true -} + } - const imageUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 \ No newline at end of file + +const newsimageUrl = 'https://ap.atxrom.com/r18';// 60s新闻图片的 URL \ No newline at end of file -- Gitee From ca1050d9d3ae7c902e4550e5813ce27553abba4b Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:31:50 +0800 Subject: [PATCH 08/85] changes --- apps/R18.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/R18.js b/apps/R18.js index d3e6c40..937e0e8 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -3,14 +3,14 @@ import { getFunctionData } from '../utils/getdate.js' export class example extends plugin { constructor() { super({ - name: '[鸢尾花插件]今日新闻', - dsc: '获取每日60s新闻', + name: '[鸢尾花插件]三次元', + dsc: '获三次元', event: 'message', priority: 5000, rule: [ { - reg: '^#?(60s日报|今日新闻)$', - fnc: '今日新闻' + reg: '^#?(三次元)$', + fnc: '三次元' } ] }); -- Gitee From c9c64d9ca67c3e423f541da28631c1ab8c72e034 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:34:42 +0800 Subject: [PATCH 09/85] changes --- apps/R18.js | 54 +++++++++++++---------------------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/apps/R18.js b/apps/R18.js index 937e0e8..43d3ff8 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -1,64 +1,36 @@ -import { getFunctionData } from '../utils/getdate.js' +import fetch from 'node-fetch'; export class example extends plugin { constructor() { super({ name: '[鸢尾花插件]三次元', - dsc: '获三次元', + dsc: '三次元', event: 'message', priority: 5000, rule: [ { reg: '^#?(三次元)$', fnc: '三次元' - } + }, ] }); - this.task = { - cron: this.newsConfig.time, - name: '推送今日新闻', - fnc: () => this.推送今日新闻(), - log: false}, - Object.defineProperty(this.task, 'log', { get: () => false }) - } + } - get newsConfig () { return getFunctionData('push', 'setpush', '今日新闻') } - async 推送今日新闻 () { - try { - // 检查是否启用自动推送 - if (!this.newsConfig.isAutoPush) { - logger.info(`[今日新闻]自动推送未启用。`); - return false; - } - logger.info(`[今日新闻]开始推送……`); - for (let i = 0; i < this.newsConfig.groupList.length; i++) { - // 添加延迟以防止消息发送过快 - setTimeout(async () => { - const group = Bot.pickGroup(this.newsConfig.groupList[i]); - logger.info(`[今日新闻]正在向群组 ${group} 推送新闻。`); - await group.sendMsg([segment.image(newsimageUrl)]); - logger.info(`[今日新闻]新闻已成功推送到群组 ${group}。`); - }, i * 1000); - } - - logger.info(`[今日新闻]推送完成。`); - return true; - } catch (error) { - logger.error(`[今日新闻]推送过程中出现错误: ${error}`); - } -} + async 三次元 (e) { + const imageUrl = Buffer.from(newsimageUrl) - async 今日新闻 (e) { + e.reply([segment.image(imageUrl)]); + + return true + } + + } - e.reply([segment.image(newsimageUrl)]); - return true - } -} -const newsimageUrl = 'https://ap.atxrom.com/r18';// 60s新闻图片的 URL \ No newline at end of file +const newsimageUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 -- Gitee From 4253b25e6f2f067732c3e6e65402bdc8225fface Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:40:18 +0800 Subject: [PATCH 10/85] changes --- apps/R18.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/R18.js b/apps/R18.js index 43d3ff8..72276fd 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -21,16 +21,20 @@ export class example extends plugin { async 三次元 (e) { - const imageUrl = Buffer.from(newsimageUrl) - - e.reply([segment.image(imageUrl)]); + let fetchUrl = await fetch(moyuapiUrl).catch(err => logger.error(err)); + let imgUrl = await fetchUrl.json(); + imgUrl = await imgUrl.img; + imgUrl = imgUrl.replace("data:image/png;base64,", "base64://"); + + e.reply([segment.image(imgUrl)]); return true - } + } + } -const newsimageUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 +const moyuapiUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 -- Gitee From c1e9b8b039e925af76fc4fb274d59de6087783e0 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:41:30 +0800 Subject: [PATCH 11/85] Changes --- apps/R18.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/R18.js b/apps/R18.js index 72276fd..bf79e71 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -21,20 +21,17 @@ export class example extends plugin { async 三次元 (e) { - let fetchUrl = await fetch(moyuapiUrl).catch(err => logger.error(err)); - let imgUrl = await fetchUrl.json(); - imgUrl = await imgUrl.img; - imgUrl = imgUrl.replace("data:image/png;base64,", "base64://"); - - e.reply([segment.image(imgUrl)]); + const imageUrl = Buffer.from(newsimageUrl) + imgUrl = imgUrl.replace("data:image/png;base64,", "base64://"); + + e.reply([segment.image(imageUrl)]); return true - } - + } } -const moyuapiUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 +const newsimageUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 -- Gitee From b744dfb02cb9c8b780cf4c5718a1c0124f2710f8 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:48:41 +0800 Subject: [PATCH 12/85] changes --- apps/R18.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/R18.js b/apps/R18.js index bf79e71..1d3b890 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -22,9 +22,9 @@ export class example extends plugin { async 三次元 (e) { const imageUrl = Buffer.from(newsimageUrl) - imgUrl = imgUrl.replace("data:image/png;base64,", "base64://"); + imgUrl = imageUrl.replace("data:image/png;base64,", "base64://"); - e.reply([segment.image(imageUrl)]); + e.reply([segment.image(imgUrl)]); return true } -- Gitee From e94469ee2c10592fe50a27a73242a2aada50ade6 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:48:49 +0800 Subject: [PATCH 13/85] changes --- apps/R18.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/R18.js b/apps/R18.js index 1d3b890..8c2adb0 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -1,5 +1,3 @@ -import fetch from 'node-fetch'; - export class example extends plugin { constructor() { super({ @@ -20,11 +18,9 @@ export class example extends plugin { - async 三次元 (e) { - const imageUrl = Buffer.from(newsimageUrl) - imgUrl = imageUrl.replace("data:image/png;base64,", "base64://"); + async 今日新闻 (e) { - e.reply([segment.image(imgUrl)]); + e.reply([segment.image(newsimageUrl)]); return true } @@ -34,4 +30,8 @@ export class example extends plugin { -const newsimageUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 + + + + +const newsimageUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 \ No newline at end of file -- Gitee From 547f90956915eaa051a5a63d9e6bf1e137ff8cb4 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 31 Oct 2024 20:53:57 +0800 Subject: [PATCH 14/85] =?UTF-8?q?=E6=9C=80=E5=90=8E=E4=B8=80=E6=AC=A1=20?= =?UTF-8?q?=E8=87=AA=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/R18.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/apps/R18.js b/apps/R18.js index 8c2adb0..2825f95 100644 --- a/apps/R18.js +++ b/apps/R18.js @@ -1,3 +1,4 @@ + export class example extends plugin { constructor() { super({ @@ -18,7 +19,7 @@ export class example extends plugin { - async 今日新闻 (e) { + async 三次元 (e) { e.reply([segment.image(newsimageUrl)]); @@ -27,11 +28,4 @@ export class example extends plugin { } - - - - - - - const newsimageUrl = 'https://ap.atxrom.com/r18';// 三次元接口地址 自己用 \ No newline at end of file -- Gitee From 7602212514123373247802becd110ec6c81ba841 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Wed, 18 Dec 2024 20:44:04 +0800 Subject: [PATCH 15/85] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- defSet/API.yaml | 6 +++--- defSet/Push.yaml | 4 ++-- defSet/Weather.yaml | 2 +- guoba.support.js | 10 +--------- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/defSet/API.yaml b/defSet/API.yaml index 52b9f43..836040e 100644 --- a/defSet/API.yaml +++ b/defSet/API.yaml @@ -2,15 +2,15 @@ API: - FunctionName: 摸鱼日历 SourceUrl: https://api.vvhan.com/api/moyu isAutoPush: false - PushTime: 0 0 */1 * * ? + "PushTime": 0 0 */1 * * ? PushGroupList: [] - FunctionName: 今日新闻 SourceUrl: https://api.03c3.cn/api/zb isAutoPush: false - PushTime: 00 30 9 * * ? + "PushTime": 00 30 9 * * ? PushGroupList: [] - FunctionName: 真寻日报 SourceUrl: https://api.atxrom.cn/ isAutoPush: false - PushTime: 0 30 7 * * ? + "PushTime": 0 30 7 * * ? PushGroupList: [] diff --git a/defSet/Push.yaml b/defSet/Push.yaml index 7c7c1ec..0b43899 100644 --- a/defSet/Push.yaml +++ b/defSet/Push.yaml @@ -1,9 +1,9 @@ Push: - FunctionName: 定时发图 isAutoPush: false - PushTime: 0 0 */1 * * ? + "PushTime": 0 0 */1 * * ? PushGroupList: [] - FunctionName: 今日番剧 isAutoPush: false - PushTime: 0 30 18 * * ? + "PushTime": 0 30 18 * * ? PushGroupList: [] diff --git a/defSet/Weather.yaml b/defSet/Weather.yaml index d16d4ac..c64e0b2 100644 --- a/defSet/Weather.yaml +++ b/defSet/Weather.yaml @@ -1,5 +1,5 @@ WeatherKey: null WeatherPushSwitch: false -WeatherPushTime: 0 30 8 * * ? +"WeatherPushTime": 0 30 8 * * ? WeatherPushgroup: [] \ No newline at end of file diff --git a/guoba.support.js b/guoba.support.js index 60490fe..4d658e6 100644 --- a/guoba.support.js +++ b/guoba.support.js @@ -252,9 +252,6 @@ export function supportGuoba() { field: 'PushTime', label: '推送时间', component: 'EasyCron', - componentProps: { - placeholder: '请输入或选择Cron表达式', - }, }, { field: 'PushGroupList', @@ -299,9 +296,6 @@ export function supportGuoba() { field: 'PushTime', label: '推送时间', component: 'EasyCron', - componentProps: { - placeholder: '请输入或选择Cron表达式', - }, }, { field: 'PushGroupList', @@ -334,9 +328,7 @@ export function supportGuoba() { field: 'Weather.WeatherPushTime', label: '推送时间', component: 'EasyCron', - componentProps: { - placeholder: '请输入或选择Cron表达式', - }, + }, { field: "Weather.WeatherPushgroup", -- Gitee From f218e7617bf84db671049b351c185c1ad04e1b54 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 19 Dec 2024 01:39:18 +0800 Subject: [PATCH 16/85] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a32266e..92b7f7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +# 1.0.1(beta) +- 修复bug # 1.0.0 - 修改大部分插件 -- Gitee From e3db05e15685e93059ad10f065a705675f096a30 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 19 Dec 2024 06:16:25 +0000 Subject: [PATCH 17/85] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiaodoubi <775146701@qq.com> --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92b7f7f..90d322c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # 1.0.1(beta) + - 修复bug + # 1.0.0 - 修改大部分插件 -- Gitee From bafca3da12a209d46c511dbe3241c98dd105ae6b Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 19 Dec 2024 14:25:32 +0800 Subject: [PATCH 18/85] =?UTF-8?q?=E9=A2=84=E5=8F=91=E5=B8=83=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90d322c..c3b7474 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 1.2.0 + +- 预发布版本 + +- 修复bug + + # 1.0.1(beta) - 修复bug -- Gitee From ef34608a8f407cf795789da81e4138805c86f426 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 22 Dec 2024 10:59:03 +0800 Subject: [PATCH 19/85] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Weather.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/Weather.js b/apps/Weather.js index ddf565b..3167ec3 100644 --- a/apps/Weather.js +++ b/apps/Weather.js @@ -1,6 +1,7 @@ import puppeteer from 'puppeteer' import { NumToRoman, getImageUrl, getFunctionData } from '../utils/getdate.js' import fetch from 'node-fetch' + import setting from '../model/setting.js' export class example extends plugin { @@ -73,6 +74,7 @@ async function pushweather (e, pushcity) { let imageUrl = await getImageUrl(urlConfig.imageUrls) + let browser try { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) @@ -82,7 +84,7 @@ async function pushweather (e, pushcity) { - + -- Gitee From 3632ebd307faabdcb0404a910cf1a8e7d1f8cb68 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 22 Dec 2024 03:33:41 +0000 Subject: [PATCH 20/85] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiaodoubi <775146701@qq.com> --- apps/Weather.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Weather.js b/apps/Weather.js index 3167ec3..7053d2c 100644 --- a/apps/Weather.js +++ b/apps/Weather.js @@ -84,7 +84,7 @@ async function pushweather (e, pushcity) { - + - -
-

${nickname}的${await numToChinese(new Date().getDate())}号运势为

-

${fortune.fortuneSummary}

-

${fortune.luckyStar}

-
-

${fortune.signText}

-

${fortune.unsignText}

+ + + + + + +
+
+

${nickname}的${await numToChinese(new Date().getDate())}号运势为

+

${fortune.fortuneSummary}

+

${fortune.luckyStar}

+
+

${fortune.signText}

+

${fortune.unsignText}

+
+

| 相信科学,请勿迷信 |

+

Create By 鸢尾花插件

+
+
+ +
-

| 相信科学,请勿迷信 |

-

Create By 鸢尾花插件

-
-
- -
+ ` @@ -150,6 +211,8 @@ async function generateFortune (e) { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() await page.setContent(Html) + // 增加等待时间,确保图片加载完成 + await page.waitForSelector('img') const image = Buffer.from(await page.screenshot({ fullPage: true })) e.reply(segment.image(image)) } catch (error) { -- Gitee From 0b2b30f5813034c73c4bc9b9b41e625f76392e30 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 22 Dec 2024 11:59:31 +0800 Subject: [PATCH 23/85] =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Jrys.js | 111 ++++++++++++--------------------------------------- 1 file changed, 25 insertions(+), 86 deletions(-) diff --git a/apps/Jrys.js b/apps/Jrys.js index 8f45d2a..8fa43b0 100644 --- a/apps/Jrys.js +++ b/apps/Jrys.js @@ -116,93 +116,32 @@ async function generateFortune (e) { let Html = ` - - - - - - -
-
-

${nickname}的${await numToChinese(new Date().getDate())}号运势为

-

${fortune.fortuneSummary}

-

${fortune.luckyStar}

-
-

${fortune.signText}

-

${fortune.unsignText}

-
-

| 相信科学,请勿迷信 |

-

Create By 鸢尾花插件

-
-
- -
+ + +
+

${nickname}的${await numToChinese(new Date().getDate())}号运势为

+

${fortune.fortuneSummary}

+

${fortune.luckyStar}

+
+

${fortune.signText}

+

${fortune.unsignText}

- +

| 相信科学,请勿迷信 |

+

Create By 鸢尾花插件

+
+
+ +
` -- Gitee From 4fcdce65ec9cb7d6714fac1bd373e9f4a7535272 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 22 Dec 2024 11:59:31 +0800 Subject: [PATCH 24/85] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Jrys.js | 111 ++---- apps/Weather.js | 1009 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 1033 insertions(+), 87 deletions(-) diff --git a/apps/Jrys.js b/apps/Jrys.js index 8f45d2a..8fa43b0 100644 --- a/apps/Jrys.js +++ b/apps/Jrys.js @@ -116,93 +116,32 @@ async function generateFortune (e) { let Html = ` - - - - - - -
-
-

${nickname}的${await numToChinese(new Date().getDate())}号运势为

-

${fortune.fortuneSummary}

-

${fortune.luckyStar}

-
-

${fortune.signText}

-

${fortune.unsignText}

-
-

| 相信科学,请勿迷信 |

-

Create By 鸢尾花插件

-
-
- -
+ + +
+

${nickname}的${await numToChinese(new Date().getDate())}号运势为

+

${fortune.fortuneSummary}

+

${fortune.luckyStar}

+
+

${fortune.signText}

+

${fortune.unsignText}

- +

| 相信科学,请勿迷信 |

+

Create By 鸢尾花插件

+
+
+ +
` diff --git a/apps/Weather.js b/apps/Weather.js index 7053d2c..d9631ef 100644 --- a/apps/Weather.js +++ b/apps/Weather.js @@ -84,7 +84,1014 @@ async function pushweather (e, pushcity) { - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + +

${nickname}的${await numToChinese(new Date().getDate())}号运势为

diff --git a/apps/Sign.js b/apps/Sign.js index c9a6e8a..7473f91 100644 --- a/apps/Sign.js +++ b/apps/Sign.js @@ -64,6 +64,7 @@ export class TextMsg extends plugin { + Document @@ -96,213 +97,7 @@ export class TextMsg extends plugin {
- - - - - + + + +` - - - - ` let browser try { -- Gitee From c7edbfa1d08c2ef550772c49353493579d2fb6d3 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sat, 28 Dec 2024 14:45:20 +0800 Subject: [PATCH 45/85] =?UTF-8?q?=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Sign.js | 220 +++++++++++++++++++++++++-------------------------- 1 file changed, 110 insertions(+), 110 deletions(-) diff --git a/apps/Sign.js b/apps/Sign.js index 7473f91..4edd91c 100644 --- a/apps/Sign.js +++ b/apps/Sign.js @@ -59,117 +59,117 @@ export class TextMsg extends plugin { let nickname = e.nickname ? e.nickname : e.sender.card let Html = ` - - - - - - - Document - - -
- -
-
-
-
- -

${getTimeOfDay()}好!
${nickname}

-
-
-

${issign}

-

当前好感度:${finaldata.favor}

-

当前群排名:第${position}位

-

今日一言:
${content}

-
-
-
- -

Create By 鸢尾花插件

-
-
- - + + + + + + + Document + + +
+ +
+
+
+
+ +

${getTimeOfDay()}好!
${nickname}

+
+
+

${issign}

+

当前好感度:${finaldata.favor}

+

当前群排名:第${position}位

+

今日一言:
${content}

+
+
+
+ +

Create By 鸢尾花插件

+
+
+ + + + + + +` - - - - ` let browser try { -- Gitee From 406cb6ef1511dd4ee96d989f5b9b9e87a1f4154c Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sat, 28 Dec 2024 14:47:11 +0800 Subject: [PATCH 46/85] =?UTF-8?q?=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Sign.js | 220 +++++++++++++++++++++++++-------------------------- 1 file changed, 110 insertions(+), 110 deletions(-) diff --git a/apps/Sign.js b/apps/Sign.js index 4edd91c..7473f91 100644 --- a/apps/Sign.js +++ b/apps/Sign.js @@ -59,117 +59,117 @@ export class TextMsg extends plugin { let nickname = e.nickname ? e.nickname : e.sender.card let Html = ` - - - - - - - Document - - -
- -
-
-
-
- -

${getTimeOfDay()}好!
${nickname}

-
-
-

${issign}

-

当前好感度:${finaldata.favor}

-

当前群排名:第${position}位

-

今日一言:
${content}

-
-
-
- -

Create By 鸢尾花插件

-
-
- - - - - - -` + + + + + + + Document + + +
+ +
+
+
+
+ +

${getTimeOfDay()}好!
${nickname}

+
+
+

${issign}

+

当前好感度:${finaldata.favor}

+

当前群排名:第${position}位

+

今日一言:
${content}

+
+
+
+ +

Create By 鸢尾花插件

+
+
+ + + + + + ` let browser try { -- Gitee From 7bf268a98a27709223b9e056a30ed067607f85f9 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sat, 28 Dec 2024 14:50:16 +0800 Subject: [PATCH 47/85] =?UTF-8?q?=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Sign.js | 221 ++++++++++++++++++++++++++------------------------- 1 file changed, 111 insertions(+), 110 deletions(-) diff --git a/apps/Sign.js b/apps/Sign.js index 4edd91c..c97b20a 100644 --- a/apps/Sign.js +++ b/apps/Sign.js @@ -59,116 +59,117 @@ export class TextMsg extends plugin { let nickname = e.nickname ? e.nickname : e.sender.card let Html = ` - - - - - - - Document - - -
- -
-
-
-
- -

${getTimeOfDay()}好!
${nickname}

-
-
-

${issign}

-

当前好感度:${finaldata.favor}

-

当前群排名:第${position}位

-

今日一言:
${content}

-
-
-
- -

Create By 鸢尾花插件

-
-
- - - - - - -` + + + + + + + Document + + +
+ +
+
+
+
+ +

${getTimeOfDay()}好!
${nickname}

+
+
+

${issign}

+

当前好感度:${finaldata.favor}

+

当前群排名:第${position}位

+

今日一言:
${content}

+
+
+
+ +

Create By 鸢尾花插件

+
+
+ + + + + + + ` let browser -- Gitee From be5e62c49432397d3aff0c77af29a49d057fd7b4 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 29 Dec 2024 19:27:26 +0800 Subject: [PATCH 48/85] =?UTF-8?q?=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Jrys.js | 2 +- apps/SuanGua.js | 56 +------------------------------------------------ apps/Tarot.js | 2 +- apps/Weather.js | 4 ++-- apps/marry.js | 2 +- 5 files changed, 6 insertions(+), 60 deletions(-) diff --git a/apps/Jrys.js b/apps/Jrys.js index bcab12a..36ced6b 100644 --- a/apps/Jrys.js +++ b/apps/Jrys.js @@ -116,7 +116,7 @@ async function generateFortune (e) { let Html = ` - +
diff --git a/apps/SuanGua.js b/apps/SuanGua.js index 9fcb115..97256f0 100644 --- a/apps/SuanGua.js +++ b/apps/SuanGua.js @@ -121,61 +121,7 @@ async function generateFortune (e) { - +
diff --git a/apps/Tarot.js b/apps/Tarot.js index 52fdb85..c492a24 100644 --- a/apps/Tarot.js +++ b/apps/Tarot.js @@ -118,7 +118,7 @@ async function 抽塔罗牌 (e, replacedMsg = '', isGPT = false) { let Html = ` - +
diff --git a/apps/Weather.js b/apps/Weather.js index 18ec8de..86711ee 100644 --- a/apps/Weather.js +++ b/apps/Weather.js @@ -84,8 +84,8 @@ async function pushweather (e, pushcity) { - - + +
diff --git a/apps/marry.js b/apps/marry.js index 11c8bee..8afd4cf 100644 --- a/apps/marry.js +++ b/apps/marry.js @@ -188,7 +188,7 @@ async function generateFortune (e, replyMessage, content, imageUrl) { let Html = ` - +
-- Gitee From 23ecabcc48b8f9ba8ccfcdc266a6d898f7823271 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 29 Dec 2024 19:53:10 +0800 Subject: [PATCH 49/85] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/marry.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/marry.js b/apps/marry.js index 8afd4cf..217f4e8 100644 --- a/apps/marry.js +++ b/apps/marry.js @@ -207,11 +207,14 @@ async function generateFortune (e, replyMessage, content, imageUrl) {
` + + let browser try { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() await page.setContent(Html) + await page.waitForSelector('img') const image = Buffer.from(await page.screenshot({ fullPage: true })) e.reply([replyMessage, segment.image(image)], true) } catch (error) { -- Gitee From 2d6aa1f14a3df6e1963a2541f4257144fd83f6bb Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 29 Dec 2024 19:59:25 +0800 Subject: [PATCH 50/85] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Tarot.js | 1 + apps/Weather.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/apps/Tarot.js b/apps/Tarot.js index c492a24..1286f62 100644 --- a/apps/Tarot.js +++ b/apps/Tarot.js @@ -139,6 +139,7 @@ async function 抽塔罗牌 (e, replacedMsg = '', isGPT = false) { ` await page.setContent(Html) + await page.waitForSelector('img') const tarotimage = Buffer.from(await page.screenshot({ fullPage: true })) e.reply([segment.image(tarotimage)]) } catch (error) { diff --git a/apps/Weather.js b/apps/Weather.js index 86711ee..3d1c8c9 100644 --- a/apps/Weather.js +++ b/apps/Weather.js @@ -109,6 +109,8 @@ async function pushweather (e, pushcity) { ` await page.setContent(Html) + // 等待页面中的img元素加载完成 + await page.waitForSelector('img'); // 获取图片元素 const imgElement = await page.$('.tu img') // 对图片元素进行截图 -- Gitee From 56e3e024c4270047f63fa4cd7163159e8822e465 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 29 Dec 2024 20:01:58 +0800 Subject: [PATCH 51/85] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/SuanGua.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/SuanGua.js b/apps/SuanGua.js index 97256f0..30ff71d 100644 --- a/apps/SuanGua.js +++ b/apps/SuanGua.js @@ -158,6 +158,8 @@ async function generateFortune (e) { const page = await browser.newPage() await page.setContent(Html) + // 等待页面中的img元素加载完成 + await page.waitForSelector('img'); const imgElement = await page.$('.tu img') // 对图片元素进行截图 const image = Buffer.from(await imgElement.screenshot()) -- Gitee From 360f06743ebf19779b407fd99a1e8c4562df4d94 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 29 Dec 2024 20:10:51 +0800 Subject: [PATCH 52/85] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/SuanGua.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/SuanGua.js b/apps/SuanGua.js index 30ff71d..aa41fe7 100644 --- a/apps/SuanGua.js +++ b/apps/SuanGua.js @@ -149,26 +149,29 @@ async function generateFortune (e) { ` - let browser + let browser; try { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox', '--no-proxy-server'] - }) + }); + + const page = await browser.newPage(); + // 使用page.goto方法访问目标网址,并等待所有资源加载完成 + await page.goto('your-url', {waitUntil: 'networkidle2'}); - const page = await browser.newPage() - await page.setContent(Html) // 等待页面中的img元素加载完成 await page.waitForSelector('img'); - const imgElement = await page.$('.tu img') + const imgElement = await page.$('.tu img'); + // 对图片元素进行截图 - const image = Buffer.from(await imgElement.screenshot()) - e.reply(segment.image(image)) + const image = Buffer.from(await imgElement.screenshot()); + e.reply(segment.image(image)); } catch (error) { - logger.info('图片渲染失败') + logger.info('图片渲染失败'); } finally { if (browser) { - await browser.close() + await browser.close(); } } } -- Gitee From a9b5030e590ff5dfadb9cc80df61940ce902c89e Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 29 Dec 2024 20:14:05 +0800 Subject: [PATCH 53/85] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/SuanGua.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/SuanGua.js b/apps/SuanGua.js index aa41fe7..03149a6 100644 --- a/apps/SuanGua.js +++ b/apps/SuanGua.js @@ -158,7 +158,7 @@ async function generateFortune (e) { const page = await browser.newPage(); // 使用page.goto方法访问目标网址,并等待所有资源加载完成 - await page.goto('your-url', {waitUntil: 'networkidle2'}); + await page.goto(Html, {waitUntil: 'networkidle2'}); // 等待页面中的img元素加载完成 await page.waitForSelector('img'); @@ -174,4 +174,5 @@ async function generateFortune (e) { await browser.close(); } } -} + +} \ No newline at end of file -- Gitee From cb5a0e8ed5a41a5e188c8ae75040c23baf39bd10 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 29 Dec 2024 20:22:06 +0800 Subject: [PATCH 54/85] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Jrys.js | 5 ++--- apps/SuanGua.js | 6 ++---- apps/Tarot.js | 3 ++- apps/Weather.js | 5 ++--- apps/marry.js | 5 +++-- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/apps/Jrys.js b/apps/Jrys.js index 36ced6b..fb7e94b 100644 --- a/apps/Jrys.js +++ b/apps/Jrys.js @@ -141,9 +141,8 @@ async function generateFortune (e) { try { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() - await page.setContent(Html) - // 增加等待时间,确保图片加载完成 - await page.waitForSelector('img') + // 使用page.goto方法访问目标网址,并等待所有资源加载完成 + await page.goto(Html, { waitUntil: 'networkidle2' }); const image = Buffer.from(await page.screenshot({ fullPage: true })) e.reply(segment.image(image)) } catch (error) { diff --git a/apps/SuanGua.js b/apps/SuanGua.js index 03149a6..fe431ac 100644 --- a/apps/SuanGua.js +++ b/apps/SuanGua.js @@ -158,10 +158,8 @@ async function generateFortune (e) { const page = await browser.newPage(); // 使用page.goto方法访问目标网址,并等待所有资源加载完成 - await page.goto(Html, {waitUntil: 'networkidle2'}); + await page.goto(Html, { waitUntil: 'networkidle2' }); - // 等待页面中的img元素加载完成 - await page.waitForSelector('img'); const imgElement = await page.$('.tu img'); // 对图片元素进行截图 @@ -175,4 +173,4 @@ async function generateFortune (e) { } } -} \ No newline at end of file +} diff --git a/apps/Tarot.js b/apps/Tarot.js index 1286f62..fb1d32d 100644 --- a/apps/Tarot.js +++ b/apps/Tarot.js @@ -138,7 +138,8 @@ async function 抽塔罗牌 (e, replacedMsg = '', isGPT = false) { ` - await page.setContent(Html) + // 使用page.goto方法访问目标网址,并等待所有资源加载完成 + await page.goto(Html, { waitUntil: 'networkidle2' }); await page.waitForSelector('img') const tarotimage = Buffer.from(await page.screenshot({ fullPage: true })) e.reply([segment.image(tarotimage)]) diff --git a/apps/Weather.js b/apps/Weather.js index 3d1c8c9..df0a157 100644 --- a/apps/Weather.js +++ b/apps/Weather.js @@ -108,9 +108,8 @@ async function pushweather (e, pushcity) { ` - await page.setContent(Html) - // 等待页面中的img元素加载完成 - await page.waitForSelector('img'); + // 使用page.goto方法访问目标网址,并等待所有资源加载完成 + await page.goto(Html, { waitUntil: 'networkidle2' }); // 获取图片元素 const imgElement = await page.$('.tu img') // 对图片元素进行截图 diff --git a/apps/marry.js b/apps/marry.js index 217f4e8..68bc92a 100644 --- a/apps/marry.js +++ b/apps/marry.js @@ -213,8 +213,9 @@ async function generateFortune (e, replyMessage, content, imageUrl) { try { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() - await page.setContent(Html) - await page.waitForSelector('img') + // 使用page.goto方法访问目标网址,并等待所有资源加载完成 + await page.goto(Html, { waitUntil: 'networkidle2' }); + const image = Buffer.from(await page.screenshot({ fullPage: true })) e.reply([replyMessage, segment.image(image)], true) } catch (error) { -- Gitee From ed15cf7a4c3524174c4ed8c4e43d64b69f657445 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 29 Dec 2024 20:30:55 +0800 Subject: [PATCH 55/85] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Jrys.js | 7 ++++--- apps/SuanGua.js | 24 ++++++++++-------------- apps/Tarot.js | 6 ++---- apps/Weather.js | 5 ++--- apps/marry.js | 8 ++------ 5 files changed, 20 insertions(+), 30 deletions(-) diff --git a/apps/Jrys.js b/apps/Jrys.js index fb7e94b..c144ee8 100644 --- a/apps/Jrys.js +++ b/apps/Jrys.js @@ -116,7 +116,7 @@ async function generateFortune (e) { let Html = ` - +
@@ -141,8 +141,9 @@ async function generateFortune (e) { try { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() - // 使用page.goto方法访问目标网址,并等待所有资源加载完成 - await page.goto(Html, { waitUntil: 'networkidle2' }); + await page.setContent(Html) + // 增加等待时间,确保图片加载完成 + await page.waitForSelector('img') const image = Buffer.from(await page.screenshot({ fullPage: true })) e.reply(segment.image(image)) } catch (error) { diff --git a/apps/SuanGua.js b/apps/SuanGua.js index fe431ac..ba13bc8 100644 --- a/apps/SuanGua.js +++ b/apps/SuanGua.js @@ -121,7 +121,7 @@ async function generateFortune (e) { - +
@@ -149,28 +149,24 @@ async function generateFortune (e) { ` - let browser; + let browser try { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox', '--no-proxy-server'] - }); - - const page = await browser.newPage(); - // 使用page.goto方法访问目标网址,并等待所有资源加载完成 - await page.goto(Html, { waitUntil: 'networkidle2' }); - - const imgElement = await page.$('.tu img'); + }) + const page = await browser.newPage() + await page.setContent(Html) + const imgElement = await page.$('.tu img') // 对图片元素进行截图 - const image = Buffer.from(await imgElement.screenshot()); - e.reply(segment.image(image)); + const image = Buffer.from(await imgElement.screenshot()) + e.reply(segment.image(image)) } catch (error) { - logger.info('图片渲染失败'); + logger.info('图片渲染失败') } finally { if (browser) { - await browser.close(); + await browser.close() } } - } diff --git a/apps/Tarot.js b/apps/Tarot.js index fb1d32d..e705558 100644 --- a/apps/Tarot.js +++ b/apps/Tarot.js @@ -118,7 +118,7 @@ async function 抽塔罗牌 (e, replacedMsg = '', isGPT = false) { let Html = ` - +
@@ -138,9 +138,7 @@ async function 抽塔罗牌 (e, replacedMsg = '', isGPT = false) { ` - // 使用page.goto方法访问目标网址,并等待所有资源加载完成 - await page.goto(Html, { waitUntil: 'networkidle2' }); - await page.waitForSelector('img') + await page.setContent(Html) const tarotimage = Buffer.from(await page.screenshot({ fullPage: true })) e.reply([segment.image(tarotimage)]) } catch (error) { diff --git a/apps/Weather.js b/apps/Weather.js index df0a157..8d8d91d 100644 --- a/apps/Weather.js +++ b/apps/Weather.js @@ -85,7 +85,7 @@ async function pushweather (e, pushcity) { - +
@@ -108,8 +108,7 @@ async function pushweather (e, pushcity) { ` - // 使用page.goto方法访问目标网址,并等待所有资源加载完成 - await page.goto(Html, { waitUntil: 'networkidle2' }); + await page.setContent(Html) // 获取图片元素 const imgElement = await page.$('.tu img') // 对图片元素进行截图 diff --git a/apps/marry.js b/apps/marry.js index 68bc92a..8fc3935 100644 --- a/apps/marry.js +++ b/apps/marry.js @@ -188,7 +188,7 @@ async function generateFortune (e, replyMessage, content, imageUrl) { let Html = ` - +
@@ -207,15 +207,11 @@ async function generateFortune (e, replyMessage, content, imageUrl) {
` - - let browser try { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() - // 使用page.goto方法访问目标网址,并等待所有资源加载完成 - await page.goto(Html, { waitUntil: 'networkidle2' }); - + await page.setContent(Html) const image = Buffer.from(await page.screenshot({ fullPage: true })) e.reply([replyMessage, segment.image(image)], true) } catch (error) { -- Gitee From 295e3b34a5772ce54a33d6892b8fc45c91c54610 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Sun, 29 Dec 2024 20:54:10 +0800 Subject: [PATCH 56/85] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Jrys.js | 2 -- apps/Sign.js | 6 +++--- apps/SuanGua.js | 1 + apps/Weather.js | 5 ++--- apps/marry.js | 30 +++++++++++++++++++++--------- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/apps/Jrys.js b/apps/Jrys.js index c144ee8..77d66b2 100644 --- a/apps/Jrys.js +++ b/apps/Jrys.js @@ -142,8 +142,6 @@ async function generateFortune (e) { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() await page.setContent(Html) - // 增加等待时间,确保图片加载完成 - await page.waitForSelector('img') const image = Buffer.from(await page.screenshot({ fullPage: true })) e.reply(segment.image(image)) } catch (error) { diff --git a/apps/Sign.js b/apps/Sign.js index c97b20a..ae9a38f 100644 --- a/apps/Sign.js +++ b/apps/Sign.js @@ -64,7 +64,7 @@ export class TextMsg extends plugin { - + Document @@ -168,8 +168,7 @@ export class TextMsg extends plugin { ctx.globalAlpha = 1; }; } - - ` + ` let browser @@ -180,6 +179,7 @@ export class TextMsg extends plugin { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() await page.setContent(Html) + const imgElement = await page.$('#main') // 对图片元素进行截图 const image = Buffer.from(await imgElement.screenshot()) diff --git a/apps/SuanGua.js b/apps/SuanGua.js index ba13bc8..b532637 100644 --- a/apps/SuanGua.js +++ b/apps/SuanGua.js @@ -158,6 +158,7 @@ async function generateFortune (e) { const page = await browser.newPage() await page.setContent(Html) + const imgElement = await page.$('.tu img') // 对图片元素进行截图 const image = Buffer.from(await imgElement.screenshot()) diff --git a/apps/Weather.js b/apps/Weather.js index 8d8d91d..5697850 100644 --- a/apps/Weather.js +++ b/apps/Weather.js @@ -84,7 +84,7 @@ async function pushweather (e, pushcity) { - + @@ -109,11 +109,10 @@ async function pushweather (e, pushcity) { ` await page.setContent(Html) - // 获取图片元素 + // 获取图片元素 const imgElement = await page.$('.tu img') // 对图片元素进行截图 const image = await imgElement.screenshot() - return image } catch (error) { logger.error(error) diff --git a/apps/marry.js b/apps/marry.js index 8fc3935..b71b443 100644 --- a/apps/marry.js +++ b/apps/marry.js @@ -179,7 +179,7 @@ async function generateFortune (e, replyMessage, content, imageUrl) { '良缘相遇情不禁,一种缘分两处思', '情投意合如芝兰,同心协力共克艰', '桃花潭水深千尺,不及汪伦送我情', - '花开花落两相知,缘来缘去共相守' ] + '花开花落两相知,缘来缘去共相守'] if (!content) { let randomIndex = Math.floor(Math.random() * 结婚诗词.length) content = 结婚诗词[randomIndex] @@ -207,18 +207,30 @@ async function generateFortune (e, replyMessage, content, imageUrl) {
` - let browser + + let browser; try { - browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) - const page = await browser.newPage() - await page.setContent(Html) - const image = Buffer.from(await page.screenshot({ fullPage: true })) - e.reply([replyMessage, segment.image(image)], true) + // 启动Puppeteer浏览器实例,设置无头模式,并添加一些启动参数以避免某些环境下的权限问题 + browser = await puppeteer.launch({headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox']}); + + // 创建一个新的页面实例 + const page = await browser.newPage(); + + // 设置页面内容为HTML字符串(这里假设Html变量已经定义并包含了要渲染的HTML内容) + await page.setContent(Html); + + // 截取整个页面的图片,并将结果转换为Buffer对象 + const image = Buffer.from(await page.screenshot({fullPage: true})); + + // 发送包含图片的消息 + e.reply([replyMessage, segment.image(image)], true); } catch (error) { - logger.info('[今日老婆]:图片渲染失败,使用文本发送') + // 如果过程中发生错误,记录日志,并尝试使用文本消息回复 + logger.info('[今日老婆]:图片渲染失败,使用文本发送'); } finally { + // 无论是否发生错误,确保浏览器实例被关闭 if (browser) { - await browser.close() + await browser.close(); } } } -- Gitee From c1c1cec4e39c6cfe9a7565a4dfb80a027ee1c053 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Tue, 31 Dec 2024 13:49:54 +0800 Subject: [PATCH 57/85] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Jrys.js | 101 +++++++++++++++++++----- apps/Sign.js | 205 +++++++++++++++++++++++++++++++++++++++++++++++- apps/SuanGua.js | 65 ++++++++++++++- apps/Tarot.js | 105 ++++++++++++++++++++----- apps/Weather.js | 3 +- apps/marry.js | 70 ++++++++++++++++- 6 files changed, 503 insertions(+), 46 deletions(-) diff --git a/apps/Jrys.js b/apps/Jrys.js index 77d66b2..aeddfd9 100644 --- a/apps/Jrys.js +++ b/apps/Jrys.js @@ -114,27 +114,86 @@ async function generateFortune (e) { const fortune = JSON.parse(data).fortune let Html = ` - - - - - -
-

${nickname}的${await numToChinese(new Date().getDate())}号运势为

-

${fortune.fortuneSummary}

-

${fortune.luckyStar}

-
-

${fortune.signText}

-

${fortune.unsignText}

-
-

| 相信科学,请勿迷信 |

-

Create By 鸢尾花插件

-
-
- -
- - + + + + + + +
+

${nickname}的${await numToChinese(new Date().getDate())}号运势为

+

${fortune.fortuneSummary}

+

${fortune.luckyStar}

+
+

${fortune.signText}

+

${fortune.unsignText}

+
+

| 相信科学,请勿迷信 |

+

Create By 鸢尾花插件

+
+
+ +
+ + ` let browser diff --git a/apps/Sign.js b/apps/Sign.js index ae9a38f..70ba91a 100644 --- a/apps/Sign.js +++ b/apps/Sign.js @@ -65,7 +65,210 @@ export class TextMsg extends plugin { - Document + +
diff --git a/apps/SuanGua.js b/apps/SuanGua.js index b532637..104971c 100644 --- a/apps/SuanGua.js +++ b/apps/SuanGua.js @@ -121,7 +121,70 @@ async function generateFortune (e) { - +
diff --git a/apps/Tarot.js b/apps/Tarot.js index e705558..35967ae 100644 --- a/apps/Tarot.js +++ b/apps/Tarot.js @@ -116,26 +116,91 @@ async function 抽塔罗牌 (e, replacedMsg = '', isGPT = false) { const page = await browser.newPage() let Html = ` - - - - - -
-

${randomCard.name_cn}

-

${randomCard.name_en}

-
-

${meaning}

-
-

${position}

-
-

Create By 鸢尾花插件

-
-
- -
- - + + + + + +
+

${randomCard.name_cn}

+

${randomCard.name_en}

+
+

${meaning}

+
+

${position}

+
+

Create By 鸢尾花插件

+
+
+ +
+ + ` await page.setContent(Html) diff --git a/apps/Weather.js b/apps/Weather.js index 5697850..358755e 100644 --- a/apps/Weather.js +++ b/apps/Weather.js @@ -84,8 +84,7 @@ async function pushweather (e, pushcity) { - - +
diff --git a/apps/marry.js b/apps/marry.js index b71b443..9306d4c 100644 --- a/apps/marry.js +++ b/apps/marry.js @@ -188,7 +188,75 @@ async function generateFortune (e, replyMessage, content, imageUrl) { let Html = ` - +
-- Gitee From f7595514c7c406e81eed293b5ea0b3bc2c49618a Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Tue, 31 Dec 2024 14:00:29 +0800 Subject: [PATCH 58/85] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ac8a78..545458b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.2.2 + +- 代码优化 +- 后续代码准备本地化 + # 1.2.1 - 预发布版本 -- Gitee From 05ff97ced47332e63c50c567e0eb99d8a5ca66b5 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Tue, 31 Dec 2024 15:10:12 +0800 Subject: [PATCH 59/85] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Bangumi.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/Bangumi.js b/apps/Bangumi.js index 5c4496b..34910ed 100644 --- a/apps/Bangumi.js +++ b/apps/Bangumi.js @@ -91,9 +91,18 @@ export class TextMsg extends plugin { async function getItems () { - let response = await fetch('https://api.bgm.tv/calendar') + let response = null; - let data = await response.json() + try { + response = await fetch('https://api.bgm.tv/calendar'); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + } catch (error) { + console.error('Fetch error:', error); + } + if (response) { + let data = await response.json(); let now = new Date() @@ -110,15 +119,12 @@ async function getItems () { image: item.images ? item.images.common : '' } }).filter(item => item.name && item.score && item.image) // 过滤掉任何属性为空的项 - logger.info(itemDetails) // 将 itemDetails 存入 Redis await redis.set(`itemDetails`, JSON.stringify(itemDetails),{ EX: 14400 }) - - return itemDetails -} +}} async function test() { // 从 Redis 获取数据,如果 Redis 中没有数据,则先获取并存入 -- Gitee From 19c4864dffb612d96e0f19db16c65a9dd6e172f5 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Tue, 31 Dec 2024 15:13:39 +0800 Subject: [PATCH 60/85] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Bangumi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Bangumi.js b/apps/Bangumi.js index 34910ed..023e5d2 100644 --- a/apps/Bangumi.js +++ b/apps/Bangumi.js @@ -114,7 +114,7 @@ async function getItems () { // 提取 name_cn、rating 和 images 属性并组成新的数组 let itemDetails = items.map(item => { return { - name: item.name_cn || '', + name: item.name || '', score: item.rating ? item.rating.score : '', image: item.images ? item.images.common : '' } -- Gitee From 5de7c10504972ee185f53f3d24a83bb90eed53b4 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Tue, 31 Dec 2024 15:20:34 +0800 Subject: [PATCH 61/85] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Bangumi.js | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/apps/Bangumi.js b/apps/Bangumi.js index 023e5d2..9f33bd6 100644 --- a/apps/Bangumi.js +++ b/apps/Bangumi.js @@ -91,30 +91,19 @@ export class TextMsg extends plugin { async function getItems () { - let response = null; + let response = await fetch('https://api.bgm.tv/calendar'); + let data = await response.json(); - try { - response = await fetch('https://api.bgm.tv/calendar'); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - } catch (error) { - console.error('Fetch error:', error); - } - if (response) { - let data = await response.json(); - - let now = new Date() - - let weekday = (now.getDay() + 6) % 7 + 1 // 将星期日转换为7,星期一到星期六转换为1到6 + let now = new Date(); + let weekday = now.getDay(); // 获取当前的星期几,注意 JavaScript 的星期是从 0(周日)开始的 // 找到对应星期的项目 - let items = data.find(item => item.weekday.id === weekday).items + let items = data.find(item => item.weekday.id === weekday).items; // 提取 name_cn、rating 和 images 属性并组成新的数组 let itemDetails = items.map(item => { return { - name: item.name || '', + name: item.name_cn || item.name || '', score: item.rating ? item.rating.score : '', image: item.images ? item.images.common : '' } -- Gitee From 1b0f49f383a366f105a5f27ff68269f174dd5741 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Tue, 31 Dec 2024 15:22:12 +0800 Subject: [PATCH 62/85] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Bangumi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Bangumi.js b/apps/Bangumi.js index 9f33bd6..f0a21c6 100644 --- a/apps/Bangumi.js +++ b/apps/Bangumi.js @@ -113,7 +113,7 @@ async function getItems () { await redis.set(`itemDetails`, JSON.stringify(itemDetails),{ EX: 14400 }) return itemDetails -}} +} async function test() { // 从 Redis 获取数据,如果 Redis 中没有数据,则先获取并存入 -- Gitee From 199bfd6f62cf2793455ec8076ff010b93d858816 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Tue, 31 Dec 2024 15:25:41 +0800 Subject: [PATCH 63/85] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Bangumi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Bangumi.js b/apps/Bangumi.js index f0a21c6..4914750 100644 --- a/apps/Bangumi.js +++ b/apps/Bangumi.js @@ -110,7 +110,7 @@ async function getItems () { }).filter(item => item.name && item.score && item.image) // 过滤掉任何属性为空的项 logger.info(itemDetails) // 将 itemDetails 存入 Redis - await redis.set(`itemDetails`, JSON.stringify(itemDetails),{ EX: 14400 }) + await redis.set(`itemDetails`, JSON.stringify(itemDetails),{ EX: 3600 }) return itemDetails } -- Gitee From dfa6b73eeed4c8b363bb057454111b25ef74007e Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Tue, 31 Dec 2024 11:44:07 +0000 Subject: [PATCH 64/85] ^^^^ Signed-off-by: xiaodoubi <775146701@qq.com> --- apps/Sign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Sign.js b/apps/Sign.js index 70ba91a..7e206b2 100644 --- a/apps/Sign.js +++ b/apps/Sign.js @@ -64,7 +64,7 @@ export class TextMsg extends plugin { - + + -
-

${nickname}的${await numToChinese(new Date().getDate())}号运势为

-

${fortune.fortuneSummary}

-

${fortune.luckyStar}

-
-

${fortune.signText}

-

${fortune.unsignText}

+ +
+
+

${nickname}的${await numToChinese(new Date().getDate())}号运势为

+

${fortune.fortuneSummary}

+

${fortune.luckyStar}

+
+

${fortune.signText}

+

${fortune.unsignText}

+
+

| 相信科学,请勿迷信 |

+

Create By 鸢尾花插件

+
+
+ +
-

| 相信科学,请勿迷信 |

-

Create By 鸢尾花插件

-
-
- -
+ ` @@ -150,6 +212,7 @@ async function generateFortune (e) { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() await page.setContent(Html) + await page.waitForSelector('img') const image = Buffer.from(await page.screenshot({ fullPage: true })) e.reply(segment.image(image)) } catch (error) { -- Gitee From e93350d294ff25e77ab4317fab120ac930a031ed Mon Sep 17 00:00:00 2001 From: OverTimeBunny Date: Thu, 2 Jan 2025 11:04:37 +0000 Subject: [PATCH 67/85] =?UTF-8?q?update=20apps/Sign.js.=20=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=B1=85=E4=B8=AD=EF=BC=8C=E8=B0=83=E6=95=B4=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E7=BE=8E=E5=8C=96=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: OverTimeBunny --- apps/Sign.js | 409 +++++++++++++-------------------------------------- 1 file changed, 100 insertions(+), 309 deletions(-) diff --git a/apps/Sign.js b/apps/Sign.js index c9a6e8a..a60240a 100644 --- a/apps/Sign.js +++ b/apps/Sign.js @@ -2,18 +2,17 @@ import puppeteer from 'puppeteer' import { getTimeOfDay, getImageUrl, getFunctionData } from '../utils/getdate.js' import fetch from 'node-fetch' -// TextMsg可自行更改,其他照旧即可。 export class TextMsg extends plugin { constructor () { super({ - name: '[鸢尾花插件]今日签到', // 插件名称 - dsc: '今日签到', // 插件描述 - event: 'message', // 更多监听事件请参考下方的 Events - priority: 5000, // 插件优先度,数字越小优先度越高 + name: '[鸢尾花插件]今日签到', + dsc: '今日签到', + event: 'message', + priority: 5000, rule: [ { - reg: '^#?(今日)?(签到|打卡)$', // 正则表达式,有关正则表达式请自行百度 - fnc: '今日签到' // 执行方法 + reg: '^#?(今日)?(签到|打卡)$', + fnc: '今日签到' } ] }) @@ -23,7 +22,7 @@ export class TextMsg extends plugin { async 今日签到 (e) { let now = new Date() - let datatime = now.toLocaleDateString('zh-CN') // 日期格式 + let datatime = now.toLocaleDateString('zh-CN') const response = await fetch('https://v1.hitokoto.cn') const hitokodata = await response.json() @@ -64,316 +63,109 @@ export class TextMsg extends plugin { - Document + 签到结果 +
- -
-
-
-
- -

${getTimeOfDay()}好!
${nickname}

-
-
+
- -

Create By 鸢尾花插件

+
+
${datatime}
+ 背景图 +

“${content}”

+
+
- - - - - - - - ` let browser @@ -385,7 +177,6 @@ export class TextMsg extends plugin { const page = await browser.newPage() await page.setContent(Html) const imgElement = await page.$('#main') - // 对图片元素进行截图 const image = Buffer.from(await imgElement.screenshot()) e.reply(segment.image(image)) } catch (error) { -- Gitee From e5b6e10599d60316e5bbc46b92f4fb70c859035a Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 2 Jan 2025 11:31:56 +0000 Subject: [PATCH 68/85] update apps/Jrys.js. Signed-off-by: xiaodoubi <775146701@qq.com> --- apps/Jrys.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Jrys.js b/apps/Jrys.js index 98296da..6b0fb7b 100644 --- a/apps/Jrys.js +++ b/apps/Jrys.js @@ -119,7 +119,7 @@ async function generateFortune (e) { - - -
-

${randomCard.name_cn}

-

${randomCard.name_en}

-
-

${meaning}

-
-

${position}

-
-

Create By 鸢尾花插件

-
-
- -
- - - ` - - await page.setContent(Html) - const tarotimage = Buffer.from(await page.screenshot({ fullPage: true })) - e.reply([segment.image(tarotimage)]) - } catch (error) { - logger.error(error) - } finally { - if (browser) { - await browser.close() - } - } - return true -} - -async function 占卜塔罗牌 (e, replacedMsg = '', isGPT = false) { - const forward = ['正在为您抽牌……'] - const keys = Object.keys(tarot.cards) - const randomCards = [] - const cardPositions = [] - - for (let i = 0; i < 3; i++) { - let randomCard - do { - const randomIndex = Math.floor(Math.random() * keys.length) - const randomKey = keys[randomIndex] - randomCard = tarot.cards[randomKey] - } while (randomCards.includes(randomCard)) - - randomCards.push(randomCard) - - const position = Math.random() < 0.5 ? 'up' : 'down' - cardPositions.push(position) - - const imageUrl = `https://gitee.com/logier/logier-plugin/raw/master/resources/%E5%A1%94%E7%BD%97%E7%89%8C/${randomCard.type}/${randomCard.pic}.webp` - - const forwardMsg = [ - `你抽到的第${i + 1}张牌是 ${randomCard.name_cn} (${randomCard.name_en})\n\n${position === 'up' ? '正位' : '逆位'}: ${randomCard.meaning[position]}\n\n卡牌描述: ${position === 'up' ? randomCard.info.description : randomCard.info.reverseDescription}`, - segment.image(imageUrl) - ] - - forward.push(forwardMsg) - } - - if (isGPT) { - const message = [ - { role: 'system', content: `我请求你担任塔罗占卜师的角色。 我想占卜的内容是${replacedMsg},请你根据我抽到的三张牌,帮我解释其含义,并给我一些建议。` }, - ...randomCards.map((card, i) => ({ - role: 'user', - content: `我抽到的第${i + 1}张牌是${card.name_cn},并且是${cardPositions[i] === 'up' ? '正位' : '逆位'},这代表${card.meaning[cardPositions[i]]}` - })) - ] - - const content = await gpt(message) - - if (content == true) { - logger.info('gpt出错,没有返回内容') - } else { - forward.push(content) - } - } - - let nickname = e.nickname ? e.nickname : e.sender.card - - const msg = await common.makeForwardMsg(e, forward, `${nickname}的${replacedMsg}占卜`) - await e.reply(msg) - - return true -} -- Gitee From acb81babae8f36cd5a0a4279696a953330ef1f02 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 2 Jan 2025 11:40:39 +0000 Subject: [PATCH 70/85] add Signed-off-by: xiaodoubi <775146701@qq.com> --- apps/Tarot.js | 268 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 268 insertions(+) create mode 100644 apps/Tarot.js diff --git a/apps/Tarot.js b/apps/Tarot.js new file mode 100644 index 0000000..f923d55 --- /dev/null +++ b/apps/Tarot.js @@ -0,0 +1,268 @@ +import puppeteer from 'puppeteer' +import common from '../../../lib/common/common.js' +import { readAndParseJSON, gpt } from '../utils/getdate.js' +import setting from '../model/setting.js' + +export class TextMsg extends plugin { + constructor () { + super({ + name: '[鸢尾花插件]塔罗牌', // 插件名称 + dsc: '塔罗牌', // 插件描述 + event: 'message', // 更多监听事件请参考下方的 Events + priority: 5000, // 插件优先度,数字越小优先度越高 + rule: [ + { + reg: '^#?(塔罗牌|塔罗)(.*)$', // 正则表达式,有关正则表达式请自行百度 + fnc: '塔罗牌' // 执行方法 + }, + { + reg: '^#?(占卜)(.*)$', // 正则表达式,有关正则表达式请自行百度 + fnc: '占卜' // 执行方法 + }, + { + reg: '^#?(彩虹塔罗牌)(.*)$', // 正则表达式,有关正则表达式请自行百度 + fnc: '彩虹塔罗牌' // 执行方法 + } + ] + }) + } + + get GPTconfig () { + return setting.getConfig('GPTconfig') + } + + async 塔罗牌 (e) { + const replacedMsg = e.msg.replace(/^#?(塔罗牌|塔罗)/, '') + + if (replacedMsg && this.GPTconfig.GPTKey) { + e.reply(`大占卜家正在为您占卜“${replacedMsg}”`, true, { recallMsg: 10 }) + await 抽塔罗牌(e, replacedMsg, true) + } else { + e.reply('正在为您抽塔罗牌(配置gpt后发送 塔罗牌+占卜内容 可以使用AI占卜)', true, { recallMsg: 10 }) + await 抽塔罗牌(e) + } + return true + } + + async 占卜 (e) { + const replacedMsg = e.msg.replace(/^#?(占卜)/, '') + + if (replacedMsg && this.GPTconfig.GPTKey) { + e.reply(`大占卜家正在为您占卜“${replacedMsg}”`, true, { recallMsg: 10 }) + await 占卜塔罗牌(e, replacedMsg, true) + } else { + e.reply('正在为您抽三张塔罗牌(配置gpt后发送 占卜+占卜内容 可以抽三张AI占卜)', true, { recallMsg: 10 }) + await 占卜塔罗牌(e) + } + return true + } + + async 彩虹塔罗牌 (e) { + const keys = Object.keys(tarot.cards).filter(key => key >= 0 && key <= 21) + const randomKey = keys[Math.floor(Math.random() * keys.length)] + const randomCard = tarot.cards[randomKey] + + logger.info(randomCard) + + // 创建塔罗牌的正位和逆位选项并随机选择一个选项 + const options = [`正位: ${randomCard.meaning.up}`, `逆位: ${randomCard.meaning.down}`] + const selection = options[Math.floor(Math.random() * options.length)] + let [position, meaning] = selection.split(': ') + + e.reply([`你抽到的牌是……\n第${randomKey}位\n${randomCard.name_cn}(${randomCard.name_en})\n${position}:\n${meaning}`, segment.image(`./plugins/logier-plugin/resources/nijitarot/${randomKey}.webp`)]) + + return true + } +} + +const tarot = await readAndParseJSON('../data/tarot.json') + +async function 抽塔罗牌 (e, replacedMsg = '', isGPT = false) { + // 获取所有塔罗牌的键并随机选择一张塔罗牌 + const keys = Object.keys(tarot.cards) + const randomKey = keys[Math.floor(Math.random() * keys.length)] + const randomCard = tarot.cards[randomKey] + + // 获取塔罗牌的图片URL + const imageUrl = `https://gitee.com/logier/logier-plugin/raw/master/resources/%E5%A1%94%E7%BD%97%E7%89%8C/${randomCard.type}/${randomCard.pic}.webp` + + // 创建塔罗牌的正位和逆位选项并随机选择一个选项 + const options = [`正位: ${randomCard.meaning.up}`, `逆位: ${randomCard.meaning.down}`] + const selection = options[Math.floor(Math.random() * options.length)] + let [position, meaning] = selection.split(': ') + + if (isGPT) { + // 创建GPT的输入内容 + const gptInput = [ + { + role: 'system', + content: `我请求你担任塔罗占卜师的角色。 我想占卜的内容是${replacedMsg},我抽到的牌是${randomCard.name_cn},并且是${selection},请您结合我想占卜的内容来解释含义,话语尽可能简洁。` + } + ] + + // 使用GPT生成内容 + meaning = await gpt(gptInput) + + // 如果没有生成内容,记录错误并结束进程 + if (meaning == true) { + logger.info('[鸢尾花插件]key或url配置错误,') + return false + } + } + + let browser + try { + browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) + const page = await browser.newPage() + + let Html = ` + + + + + +
+

${randomCard.name_cn}

+

${randomCard.name_en}

+
+

${meaning}

+
+

${position}

+

Create By 鸢尾花插件

+
+
+ +
+ + + ` + + await page.setContent(Html) + const tarotimage = Buffer.from(await page.screenshot({ fullPage: true })) + e.reply([segment.image(tarotimage)]) + } catch (error) { + logger.error(error) + } finally { + if (browser) { + await browser.close() + } + } + return true +} + +async function 占卜塔罗牌 (e, replacedMsg = '', isGPT = false) { + const forward = ['正在为您抽牌……'] + const keys = Object.keys(tarot.cards) + const randomCards = [] + const cardPositions = [] + + for (let i = 0; i < 3; i++) { + let randomCard + do { + const randomIndex = Math.floor(Math.random() * keys.length) + const randomKey = keys[randomIndex] + randomCard = tarot.cards[randomKey] + } while (randomCards.includes(randomCard)) + + randomCards.push(randomCard) + + const position = Math.random() < 0.5 ? 'up' : 'down' + cardPositions.push(position) + + const imageUrl = `https://gitee.com/logier/logier-plugin/raw/master/resources/%E5%A1%94%E7%BD%97%E7%89%8C/${randomCard.type}/${randomCard.pic}.webp` + + const forwardMsg = [ + `你抽到的第${i + 1}张牌是 ${randomCard.name_cn} (${randomCard.name_en})\n\n${position === 'up' ? '正位' : '逆位'}: ${randomCard.meaning[position]}\n\n卡牌描述: ${position === 'up' ? randomCard.info.description : randomCard.info.reverseDescription}`, + segment.image(imageUrl) + ] + + forward.push(forwardMsg) + } + + if (isGPT) { + const message = [ + { role: 'system', content: `我请求你担任塔罗占卜师的角色。 我想占卜的内容是${replacedMsg},请你根据我抽到的三张牌,帮我解释其含义,并给我一些建议。` }, + ...randomCards.map((card, i) => ({ + role: 'user', + content: `我抽到的第${i + 1}张牌是${card.name_cn},并且是${cardPositions[i] === 'up' ? '正位' : '逆位'},这代表${card.meaning[cardPositions[i]]}` + })) + ] + + const content = await gpt(message) + + if (content == true) { + logger.info('gpt出错,没有返回内容') + } else { + forward.push(content) + } + } + + let nickname = e.nickname ? e.nickname : e.sender.card + + const msg = await common.makeForwardMsg(e, forward, `${nickname}的${replacedMsg}占卜`) + await e.reply(msg) + + return true +} -- Gitee From 9583a3baa7589d7ab153516dade36db2ddc095b4 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 2 Jan 2025 19:50:06 +0800 Subject: [PATCH 71/85] 1 --- apps/Tarot.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/Tarot.js b/apps/Tarot.js index f923d55..771d939 100644 --- a/apps/Tarot.js +++ b/apps/Tarot.js @@ -119,9 +119,22 @@ async function 抽塔罗牌 (e, replacedMsg = '', isGPT = false) { - - - -
-

${nickname}的${await numToChinese(new Date().getDate())}号运势为

-

${fortune.fortuneSummary}

-

${fortune.luckyStar}

-
-

${fortune.signText}

-

${fortune.unsignText}

-
-

| 相信科学,请勿迷信 |

-

Create By 鸢尾花插件

-
-
- -
- - + + + + + +
+
+

${nickname}的${await numToChinese(new Date().getDate())}号运势为

+

${fortune.fortuneSummary}

+

${fortune.luckyStar}

+
+

${fortune.signText}

+

${fortune.unsignText}

+
+

| 相信科学,请勿迷信 |

+

Create By 鸢尾花插件

+
+
+ +
+
+ + ` let browser @@ -200,6 +212,7 @@ async function generateFortune (e) { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() await page.setContent(Html) + await page.waitForSelector('img') const image = Buffer.from(await page.screenshot({ fullPage: true })) e.reply(segment.image(image)) } catch (error) { -- Gitee From d2e16efe12b4ca125f4b51d0aef62fb70da3e74c Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 2 Jan 2025 12:09:38 +0000 Subject: [PATCH 74/85] update apps/Sign.js. Signed-off-by: xiaodoubi <775146701@qq.com> --- apps/Sign.js | 405 +++++++++++++-------------------------------------- 1 file changed, 100 insertions(+), 305 deletions(-) diff --git a/apps/Sign.js b/apps/Sign.js index 0eda0f4..a60240a 100644 --- a/apps/Sign.js +++ b/apps/Sign.js @@ -2,27 +2,27 @@ import puppeteer from 'puppeteer' import { getTimeOfDay, getImageUrl, getFunctionData } from '../utils/getdate.js' import fetch from 'node-fetch' -// TextMsg可自行更改,其他照旧即可。 export class TextMsg extends plugin { constructor () { super({ - name: '[鸢尾花插件]今日签到', // 插件名称 - dsc: '今日签到', // 插件描述 - event: 'message', // 更多监听事件请参考下方的 Events - priority: 5000, // 插件优先度,数字越小优先度越高 + name: '[鸢尾花插件]今日签到', + dsc: '今日签到', + event: 'message', + priority: 5000, rule: [ { - reg: '^#?(今日)?(签到|打卡)$', // 正则表达式,有关正则表达式请自行百度 - fnc: '今日签到' // 执行方法 + reg: '^#?(今日)?(签到|打卡)$', + fnc: '今日签到' } ] }) } get UrlsConfig () { return getFunctionData('Urls', 'Urls', '今日签到') } + async 今日签到 (e) { let now = new Date() - let datatime = now.toLocaleDateString('zh-CN') // 日期格式 + let datatime = now.toLocaleDateString('zh-CN') const response = await fetch('https://v1.hitokoto.cn') const hitokodata = await response.json() @@ -62,314 +62,111 @@ export class TextMsg extends plugin { - + + 签到结果 + + .quote { + margin-top: 15px; + font-style: italic; + text-align: center; + color: #777; + } + + #footer { + padding: 20px; + background-color: #f8f9fa; + text-align: center; + border-top: 1px solid #eee; + color: #555; + } + + #footer .highlight { + font-weight: bold; + color: #0078d7; + } +
- -
-
-
-
- -

${getTimeOfDay()}好!
${nickname}

-
-
+
- -

Create By 鸢尾花插件

+
+
${datatime}
+ 背景图 +

“${content}”

+
+
- - - - ` - + ` let browser try { @@ -379,9 +176,7 @@ export class TextMsg extends plugin { browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }) const page = await browser.newPage() await page.setContent(Html) - const imgElement = await page.$('#main') - // 对图片元素进行截图 const image = Buffer.from(await imgElement.screenshot()) e.reply(segment.image(image)) } catch (error) { -- Gitee From ce44cb5f85954154784a09beb1b5efed0308f679 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 2 Jan 2025 12:10:07 +0000 Subject: [PATCH 75/85] update apps/Tarot.js. Signed-off-by: xiaodoubi <775146701@qq.com> --- apps/Tarot.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/apps/Tarot.js b/apps/Tarot.js index 771d939..f923d55 100644 --- a/apps/Tarot.js +++ b/apps/Tarot.js @@ -119,22 +119,9 @@ async function 抽塔罗牌 (e, replacedMsg = '', isGPT = false) { + + + +
+
+

${nickname}的${await numToChinese(new Date().getDate())}号运势为

+

${fortune.fortuneSummary}

+

${fortune.luckyStar}

+
+

${fortune.signText}

+

${fortune.unsignText}

+
+

| 相信科学,请勿迷信 |

+

Create By 鸢尾花插件

+
+
+ +
+
+ + + - .image img { - width: 100%; - height: auto; - object-fit: cover; - border-radius: 10px; - filter: brightness(95%); - } - - - -
-
-

${nickname}的${await numToChinese(new Date().getDate())}号运势为

-

${fortune.fortuneSummary}

-

${fortune.luckyStar}

-
-

${fortune.signText}

-

${fortune.unsignText}

-
-

| 相信科学,请勿迷信 |

-

Create By 鸢尾花插件

-
-
- -
-
- - ` let browser diff --git a/apps/Tarot.js b/apps/Tarot.js index bc781c4..2cea232 100644 --- a/apps/Tarot.js +++ b/apps/Tarot.js @@ -116,100 +116,93 @@ async function 抽塔罗牌 (e, replacedMsg = '', isGPT = false) { const page = await browser.newPage() let Html = ` - - - - - -
-

${randomCard.name_cn}

-

${randomCard.name_en}

-
-

${meaning}

-
-

${position}

-

Create By 鸢尾花插件

-
-
- -
- - + + + + + +
+

${randomCard.name_cn}

+

${randomCard.name_en}

+
+

${meaning}

+
+

${position}

+
+

Create By 鸢尾花插件

+
+
+ +
+ + ` await page.setContent(Html) -- Gitee From dfc0d332d6d0fb0c23cce5c30ce9bb8d80597d7c Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 2 Jan 2025 21:55:53 +0800 Subject: [PATCH 79/85] =?UTF-8?q?=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Jrys.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/Jrys.js b/apps/Jrys.js index 5b69537..298726e 100644 --- a/apps/Jrys.js +++ b/apps/Jrys.js @@ -118,7 +118,6 @@ async function generateFortune (e) { 运势页面 - -- Gitee From c873d5cdc384e53aea48097cf18fd2bd94288449 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Thu, 2 Jan 2025 21:57:51 +0800 Subject: [PATCH 80/85] =?UTF-8?q?=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Jrys.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/Jrys.js b/apps/Jrys.js index 298726e..f938735 100644 --- a/apps/Jrys.js +++ b/apps/Jrys.js @@ -118,6 +118,7 @@ async function generateFortune (e) { 运势页面 + -- Gitee From f1d963ca6baf26b6e0b53decf4f69a54da2ae26c Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Fri, 3 Jan 2025 16:58:03 +0000 Subject: [PATCH 81/85] update resources/font/qweather-icons.css. Signed-off-by: xiaodoubi <775146701@qq.com> --- resources/font/qweather-icons.css | 55 ++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/resources/font/qweather-icons.css b/resources/font/qweather-icons.css index ed92a11..0455238 100644 --- a/resources/font/qweather-icons.css +++ b/resources/font/qweather-icons.css @@ -4,12 +4,12 @@ * License: Code for MIT, Icons for CC BY 4.0 */ + @font-face { font-family: "qweather-icons"; - src: url("./fonts/qweather-icons.woff2?c4a8eb216e1e59e6c4df464b9ee6f9be") format("woff2"), -url("./fonts/qweather-icons.woff?c4a8eb216e1e59e6c4df464b9ee6f9be") format("woff"), -url("./fonts/qweather-icons.ttf?c4a8eb216e1e59e6c4df464b9ee6f9be") format("truetype"); -} + src: url("https://dd.atxrom.com/qweather-icons/fonts/qweather-icons.woff2") format("woff2"), + url("https://dd.atxrom.com/qweather-icons/fonts/qweather-icons.woff") format("woff"), + url("https://dd.atxrom.com/qweather-icons/fonts/qweather-icons.ttf") format("truetype");} [class^="qi-"]::before, [class*=" qi-"]::before { @@ -983,3 +983,50 @@ url("./fonts/qweather-icons.ttf?c4a8eb216e1e59e6c4df464b9ee6f9be") format("truet .qi-hot-fill::before { content: "\f207"; } .qi-cold-fill::before { content: "\f208"; } .qi-unknown-fill::before { content: "\f209"; } + +/*Weather.css*/ +* { + padding: 0; + margin: 0; +} +body{ + position:absolute; +} +.nei{ + float: left; + box-shadow: 3px 3px 3px #666666; + width: 50%; + min-width: 400px; + height:100%; + display:flex; + flex-direction: column; + justify-content: space-between; + border-radius:10px 10px 10px 10px; + border:1px solid #a1a1a1; + background: rgba(255, 255, 255, 0.5); + z-index:1; + position:absolute; +} +p { + color : rgba(0,0,0, 0.6); + font-size:1.5rem; + padding: 2px; + word-wrap: break-word; + white-space: pre-wrap; +} +.centered-content { + display: flex; + flex-direction: column; + justify-content: flex-start; + margin: 0 1rem 0 1rem; + height: 100%; +} +.tu{ + float: left; + border:1px solid #000000; + max-width: 1024px +} +img{ + border:1px solid #000000; + border-radius:10px 10px 10px 10px; +} \ No newline at end of file -- Gitee From 08057e97f6ff60fd8388be44551c3036a281ad63 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Fri, 3 Jan 2025 16:58:37 +0000 Subject: [PATCH 82/85] update apps/Weather.js. Signed-off-by: xiaodoubi <775146701@qq.com> --- apps/Weather.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Weather.js b/apps/Weather.js index 358755e..b1e08dd 100644 --- a/apps/Weather.js +++ b/apps/Weather.js @@ -84,7 +84,7 @@ async function pushweather (e, pushcity) { - +
-- Gitee From d425db75b5a9c2f09e41af7629c6c995f4916e44 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Wed, 8 Jan 2025 00:39:58 +0800 Subject: [PATCH 83/85] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=96=B5=E5=96=B5?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E6=8A=A5=E9=94=99=20=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E8=AE=B0=E5=BE=97=20=E7=BE=A4=E9=87=8C=E5=96=8A=E4=B8=80?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/welcome.js | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/apps/welcome.js b/apps/welcome.js index e18bd29..ec1cee2 100644 --- a/apps/welcome.js +++ b/apps/welcome.js @@ -63,20 +63,30 @@ export class outNotice extends plugin { this.tips = '退群了' } - async accept () { - if (this.e.user_id == this.e.bot.uin) return + async accept(event) { + // 如果退群的是机器人本身,则不处理 + if (event.user_id === event.bot.uin) return; - let name, msg - if (this.e.member) { - name = this.e.member.card || this.e.member.nickname - } + let name = '未知用户'; - if (name) { - msg = `${name}(${this.e.user_id}) ${this.tips}` - } else { - msg = `${this.e.user_id} ${this.tips}` + // 调试信息:输出 event.member 对象 + logger.debug(`event.member: ${JSON.stringify(event.member)}`); + + // 获取退群成员的昵称或卡片名称 + if (event.member && (event.member.card || event.member.nickname)) { + name = event.member.card || event.member.nickname; } - logger.mark(`[退出通知]${this.e.logText} ${msg}`) - await this.reply(msg) + + // 构建通知消息 + const msg = `${name}(${event.user_id}) ${this.tips}`; + + // 记录日志 + logger.info(`[退出通知] ${event.logText} ${msg}`); + + // 回复消息到群聊 + await this.bot.sendGroupMsg({ + group_id: event.group_id, + message: msg, + }); } } -- Gitee From 502d6f8fe3d49984150bbd35128a7321e641a04b Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Tue, 7 Jan 2025 16:47:49 +0000 Subject: [PATCH 84/85] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiaodoubi <775146701@qq.com> --- apps/welcome.js | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/apps/welcome.js b/apps/welcome.js index ec1cee2..22b1f63 100644 --- a/apps/welcome.js +++ b/apps/welcome.js @@ -63,30 +63,20 @@ export class outNotice extends plugin { this.tips = '退群了' } - async accept(event) { - // 如果退群的是机器人本身,则不处理 - if (event.user_id === event.bot.uin) return; - - let name = '未知用户'; - - // 调试信息:输出 event.member 对象 - logger.debug(`event.member: ${JSON.stringify(event.member)}`); + async accept () { + if (this.e.user_id == this.e.bot.uin) return - // 获取退群成员的昵称或卡片名称 - if (event.member && (event.member.card || event.member.nickname)) { - name = event.member.card || event.member.nickname; + let name, msg + if (this.e.member) { + name = this.e.member.card || this.e.member.nickname } - // 构建通知消息 - const msg = `${name}(${event.user_id}) ${this.tips}`; - - // 记录日志 - logger.info(`[退出通知] ${event.logText} ${msg}`); - - // 回复消息到群聊 - await this.bot.sendGroupMsg({ - group_id: event.group_id, - message: msg, - }); + if (name) { + msg = `${name}(${this.e.user_id}) ${this.tips}` + } else { + msg = `${this.e.user_id} ${this.tips}` + } + logger.mark(`[退出通知]${this.e.logText} ${msg}`) + await this.reply(msg) } -} +} \ No newline at end of file -- Gitee From fa2fcf2355dba37ad912f2ef166304d4fbe39736 Mon Sep 17 00:00:00 2001 From: xiaodoubi <775146701@qq.com> Date: Wed, 8 Jan 2025 02:25:12 +0800 Subject: [PATCH 85/85] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/exit.js | 27 +++++++++++++++++++++++++++ apps/welcome.js | 31 ++----------------------------- 2 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 apps/exit.js diff --git a/apps/exit.js b/apps/exit.js new file mode 100644 index 0000000..6e59670 --- /dev/null +++ b/apps/exit.js @@ -0,0 +1,27 @@ +export class outNotice extends plugin { + constructor () { + super({ + name: '退群通知', + dsc: 'xx退群了', + event: 'notice.group.decrease' + }) + /** 退群提示词 */ + this.tips = '永久的离开了我们' + } + + async accept() { + if (this.e.user_id === this.e.self_id) return + + let name, msg + if (this.e.member) { + name = this.e.member.card_old || this.e.member.nickname || this.e.member.card + } + if (name) { + msg = `${name}(${this.e.user_id}) ${this.tips}` + } else { + msg = `${this.e.user_id} ${this.tips}` + } + logger.mark(`[退出通知]${this.e.logText} ${msg}`) + await this.reply([segment.image(`https://q1.qlogo.cn/g?b=qq&s=0&nk=${this.e.user_id}`),msg ]) + } +} diff --git a/apps/welcome.js b/apps/welcome.js index 22b1f63..de67c36 100644 --- a/apps/welcome.js +++ b/apps/welcome.js @@ -1,4 +1,5 @@ import { readAndParseJSON } from '../utils/getdate.js' +import plugin from '../../../lib/plugins/plugin.js' export class newcomer extends plugin { constructor () { @@ -18,7 +19,7 @@ export class newcomer extends plugin { /** 冷却cd 30s */ let cd = 30 - if (this.e.user_id == this.e.bot.uin) return + if (this.e.user_id === this.e.bot.uin) return /** cd */ let key = `Yz:newcomers:${this.e.group_id}` @@ -51,32 +52,4 @@ export class newcomer extends plugin { } } -export class outNotice extends plugin { - constructor () { - super({ - name: '退群通知', - dsc: 'xx退群了', - event: 'notice.group.decrease' - }) - - /** 退群提示词 */ - this.tips = '退群了' - } - - async accept () { - if (this.e.user_id == this.e.bot.uin) return - let name, msg - if (this.e.member) { - name = this.e.member.card || this.e.member.nickname - } - - if (name) { - msg = `${name}(${this.e.user_id}) ${this.tips}` - } else { - msg = `${this.e.user_id} ${this.tips}` - } - logger.mark(`[退出通知]${this.e.logText} ${msg}`) - await this.reply(msg) - } -} \ No newline at end of file -- Gitee