├── LICENSE
├── README.md
├── help
├── img
│ ├── welcome1.png
│ ├── welcome2.png
│ └── welcome3.png
└── welcomeAddImg.md
├── img
├── angri.png
├── gaofenpenwu.png
├── hutaokeai.gif
├── nixiaozi.jpg
├── paimengkeai_1.png
├── paimengkeai_2.png
├── paimengkeai_3.png
├── paimengkeai_4.png
├── paipai.gif
├── xiaopaimengzouta.gif
├── xiaopaimengzouta_1.gif
├── xiaopaimengzouta_2.gif
├── xiaopaimengzouta_3.gif
├── xiaopaimengzouta_4.gif
└── xiaopaimengzouta_5.jpg
├── muxia_beating_fast.js
├── muxia_can_not_hit.js
├── muxia_countdown.js
├── muxia_duck_img.js
├── muxia_get_60s_day_news.js
├── muxia_get_day_news.js
├── muxia_hot_search.js
├── muxia_mute_commdity.js
├── muxia_recall_bot_msg.js
├── muxia_repeater.js
├── pluginHelp
├── animal.md
├── beating_fast.md
├── can_not_hit.md
├── countdown.md
├── duck_img.md
├── get_60s_day_news.md
├── get_day_news.md
├── guessingGame.md
├── hot_search.md
├── imgs
│ ├── animal
│ │ ├── 1.png
│ │ ├── 2.png
│ │ └── 3.png
│ ├── beatingFast
│ │ ├── 1.png
│ │ └── 2.png
│ ├── canNotHit
│ │ └── 1.png
│ ├── countdown
│ │ ├── 1.png
│ │ └── 2.png
│ ├── dayNews
│ │ ├── 1.jpg
│ │ ├── 2.png
│ │ ├── 3.png
│ │ ├── 4.png
│ │ ├── help_img_1.png
│ │ ├── help_img_2.png
│ │ ├── help_img_3.png
│ │ ├── help_img_4.png
│ │ └── help_img_5.png
│ ├── duckImg
│ │ ├── 1.png
│ │ ├── 2.png
│ │ ├── 3.png
│ │ └── 4.png
│ ├── guessingGame
│ │ └── 1.png
│ ├── hotSearch
│ │ ├── 1.png
│ │ └── 2.png
│ ├── muteCommdity
│ │ ├── 1.png
│ │ └── 2.png
│ ├── pixiv
│ │ ├── 1.png
│ │ ├── 2.png
│ │ └── 3.png
│ ├── recallBotMsg
│ │ └── 1.png
│ └── repeater
│ │ ├── 1.png
│ │ └── 2.png
├── mute_commdity.md
├── pixiv.md
├── recall_bot_msg.md
└── repeater.md
├── readme
├── e_.ico
└── project_logo.png
└── refactorCode
├── animal.js
├── guessingGame.js
└── pixiv.js
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Mossia
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
MuXia-js-plugin
10 |
11 | [](https://github.com/Le-niao/Yunzai-Bot) [](https://jq.qq.com/?_wv=1027&k=ygij7e1m) [](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia)
12 |
13 |
14 |
15 |
16 |
17 | 访问人数
18 | [](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia)
19 |
20 | ### 如果觉得本项目好用,点一个 star 吧
21 |
22 | logo 来自画师[memeno](https://www.pixiv.net/users/62635184),强烈安利
23 |
24 |
25 |
26 | > 由于最近oicq出现登录异常的问题,不少朋友将yunzaibot换成的icqq的版本,出现定时任务无法正常发送的情况,请按下面的提示进行修改,即可恢复定时推送的功能
27 | ```js
28 | 找到项目中的
29 | import { Group, segment } from "oicq";
30 | 修改成下面的样子
31 | import { Group, segment } from "icqq";
32 | ```
33 |
34 |
35 | # 插件列表
36 |
37 | **有插件配置问题,优先看使用说明,不懂的再加群询问**
38 | ## 原创插件
39 |
40 | | 插件名称 | 支持 v2 | 支持 v3 | 对应项目文件 | 使用帮助 |
41 | | ------ | ------ | ------- | ---------- | ------- |
42 | | 今日日报 | ❌ | ✔ | [muxia_get_day_news.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/muxia_get_day_news.js) | [今日日报使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/get_day_news.md) |
43 | | 60s 日报 | ❌ | ✔ | [muxia_get_60s_day_news.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/muxia_get_60s_day_news.js) | [60s 日报使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/get_60s_day_news.md) |
44 | | 撤回机器人消息 | ❌ | ✔ | [muxia_recall_bot_msg.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/muxia_recall_bot_msg.js) | [撤回机器人消息使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/recall_bot_msg.md) |
45 | | 热搜榜 | ❌ | ✔ | [muxia_hot_search.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/muxia_hot_search.js) | [热搜榜使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/hot_search.md) |
46 | | 自动复读 | ❌ | ✔ | [muxia_repeater.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/muxia_repeater.js) | [自动复读使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/repeater.md) |
47 | | 鸭鸭照 | ❌ | ✔ | [muxia_duck_img.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/muxia_duck_img.js) | [鸭鸭照使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/duck_img.md) |
48 | | 速速挨打 | ❌ | ✔ | [muxia_beating_fast.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/muxia_beating_fast.js) | [速速挨打使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/beating_fast.md) |
49 | | 不可以打人 | ❌ | ✔ | [muxia_can_not_hit.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/muxia_can_not_hit.js) | [不可以打人使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/can_not_hit.md) |
50 | | 禁言套餐 | ❌ | ✔ | [muxia_mute_commdity.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/muxia_mute_commdity.js) | [禁言套餐使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/mute_commdity.md) |
51 | | 倒计时 | ❌ | ✔ | [muxia_countdown.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/muxia_countdown.js) | [倒计时使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/countdown.md) |
52 |
53 | ## 重构插件
54 |
55 | ### 重构插件如有侵权,请联系我删除
56 |
57 | | 插件名称 | 支持 v2 | 支持 v3 | 重构自 | 对应项目文件 | 使用帮助 |
58 | | ------- | ------ | ------ | ----- | ----------- | ------- |
59 | | 动物 | ❌ | ✔ | [cat.js](https://gitee.com/koinori/Icepray-plugin/blob/master/apps/cat.js) | [refactorCode/animal.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/refactorCode/animal.js) | [动物使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/animal.md) |
60 | | 猜拳游戏 | ❌ | ✔ | [dawo.js](https://github.com/SmallK111407/earth-k-plugin/blob/master/apps/dawo.js) | [refactorCode/guessingGame.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/refactorCode/guessingGame.js) | [猜拳游戏使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/guessingGame.md) |
61 | | 色色 | ❌ | ✔ | [sese.js](https://github.com/SmallK111407/earth-k-plugin/blob/master/apps/sese.js) | [refactorCode/pixiv.js](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/blob/master/refactorCode/pixiv.js) | [色色使用帮助](https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia/tree/master/pluginHelp/pixiv.md) |
62 |
63 | ## 使用指南
64 |
65 | - **windows 系统**
66 |
67 | - `原创插件`使用方法
68 | 1. 将 `muxia` 开头的 js 文件复制到 `..\Yunzai-Bot\plugins\example` 目录下
69 | 2. 将 img 下的文件复制到`..\Yunzai-Bot\resources\img`目录下,`resources`目录下没有`img`目录,自行新建一个
70 | - `重构插件`使用方法
71 | 1. 将 `refactorCode` 目录下的 js 文件复制到 `..\Yunzai-Bot\plugins\example`
72 |
73 | - **linux 系统**
74 |
75 | - **前置操作 (重要 重要 重要 重要 重要)**
76 |
77 | **在 Yunzai-Bot 项目目录下执行**
78 |
79 | ```sh
80 | cd plugins
81 | git clone https://github.com/MuXia-0326/YunzaiBotJsPluginMuXia.git ./muxia
82 | ```
83 |
84 | - `原创插件`使用方法
85 |
86 | 在 **`Yunzai-Bot/plugins`** 目录下执行下面的命令
87 |
88 | ```sh
89 | mv muxia/*.js example
90 | cd ..
91 | mkdir resources/img
92 | cd plugins
93 | mv muxia/img/* resources/img
94 | ```
95 |
96 | - `重构插件`使用方法
97 |
98 | 在 **`Yunzai-Bot/plugins`** 目录下执行下面的命令
99 |
100 | ```sh
101 | mv muxia/refactorCode/*.js example
102 | ```
103 |
104 | ## 更新日志
105 |
106 | - 2022-10-08 今日日报添加定时触发,优化部分提示异常,新增**撤回机器人消息**插件
107 | - 2022-10-09 新增**热搜榜**和**自动复读**插件
108 | - 2022-10-11 新增**鸭鸭照**,修改 js 文件名称
109 | - 2022-10-14 新增**60s 读懂世界**插件,上传部分重构插件
110 | - 2022-10-19 为每个 js 插件单独编写一个使用方法,方便查阅
111 | - 2022-10-22 给 **色色插件** 添加图文开关,默认为文字模式
112 | - 2023-02-17 修复 **60s日报插件** 自动推送异常的问题
113 | - 2023-02-28 **鸭鸭照插件** 每日自动问好功能,新增了猫猫,柴犬,小鸟
114 | - 2023-03-19 新增 **倒计时插件** 现有功能,每天提醒群内高考生,高考倒计时
115 | - 2023-05-13 修改 **鸭鸭照** ,让定时任务的配置更自由,现在可以根据自己的想法随心所欲的定制定时任务的事件,文字,图片,使用方法参考使用帮助
116 |
117 | ## 免责声明
118 |
119 | 1. 功能仅限内部交流与小范围使用,请勿将 Yunzai-Bot 及本项目用于任何以盈利为目的的场景.
120 | 2. 图片与其他素材均来自于网络,仅供交流学习使用,如有侵权请联系,会立即删除.
121 |
122 | ## 其他
123 |
124 | - 群号:374900636
125 | - Yunzai-Bot:[☞Github](https://github.com/Le-niao/Yunzai-Bot) / [☞Git](https://gitee.com/Le-niao/Yunzai-Bot)
126 | - Yunzai-Bot轻量版(无原神功能):[☞Github](https://github.com/Nwflower/yunzai-bot-lite) / [☞Git](https://gitee.com/Nwflower/yunzai-bot-lite)
127 | - Yunzai-Bot 插件库:[☞github](https://github.com/yhArcadia/Yunzai-Bot-plugins-index) / [☞Git](https://gitee.com/yhArcadia/Yunzai-Bot-plugins-index)
128 |
--------------------------------------------------------------------------------
/help/img/welcome1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/help/img/welcome1.png
--------------------------------------------------------------------------------
/help/img/welcome2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/help/img/welcome2.png
--------------------------------------------------------------------------------
/help/img/welcome3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/help/img/welcome3.png
--------------------------------------------------------------------------------
/help/welcomeAddImg.md:
--------------------------------------------------------------------------------
1 | # 进群通知添加图片指南
2 |
3 | 1. 首先找到项目中实现该功能的js插件
4 | 文件存储路径 `Yunzai-bot/plugins/example/进群退群通知.js`
5 |
6 | 
7 |
8 | 2. 找到代码的28行
9 |
10 | 
11 |
12 | ```js
13 | /** 回复 */
14 | await this.reply([
15 | segment.at(this.e.user_id),
16 | // segment.image(),
17 | msg
18 | ])
19 | ```
20 |
21 | 3. 将第二步提到的代码修改成下面的样子
22 |
23 | ```js
24 | //获取项目运行路径
25 | const _path = process.cwd();
26 |
27 | /** 回复 */
28 | await this.reply(
29 | [segment.at(this.e.user_id),
30 | msg,
31 | segment.image(`file:///${_path}/resources/img/welcome.jpg`)]
32 | );
33 | ```
34 |
35 | 4. 然后找一张心仪的图片,将图片的重命名为 `welcome.jpg` 再将图片复制到
36 | `Yunzai-bot/resources/img` 目录下
37 |
38 | 一般情况下 `resources` 目录下都没有 `img` 目录,所以需要自行手动创建一个
39 |
40 | 
41 |
42 | 5. 最后,重启bot,再拉一个好朋友(工具人)测试一下,功能是否修改成功即可
43 |
--------------------------------------------------------------------------------
/img/angri.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/angri.png
--------------------------------------------------------------------------------
/img/gaofenpenwu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/gaofenpenwu.png
--------------------------------------------------------------------------------
/img/hutaokeai.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/hutaokeai.gif
--------------------------------------------------------------------------------
/img/nixiaozi.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/nixiaozi.jpg
--------------------------------------------------------------------------------
/img/paimengkeai_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/paimengkeai_1.png
--------------------------------------------------------------------------------
/img/paimengkeai_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/paimengkeai_2.png
--------------------------------------------------------------------------------
/img/paimengkeai_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/paimengkeai_3.png
--------------------------------------------------------------------------------
/img/paimengkeai_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/paimengkeai_4.png
--------------------------------------------------------------------------------
/img/paipai.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/paipai.gif
--------------------------------------------------------------------------------
/img/xiaopaimengzouta.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/xiaopaimengzouta.gif
--------------------------------------------------------------------------------
/img/xiaopaimengzouta_1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/xiaopaimengzouta_1.gif
--------------------------------------------------------------------------------
/img/xiaopaimengzouta_2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/xiaopaimengzouta_2.gif
--------------------------------------------------------------------------------
/img/xiaopaimengzouta_3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/xiaopaimengzouta_3.gif
--------------------------------------------------------------------------------
/img/xiaopaimengzouta_4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/xiaopaimengzouta_4.gif
--------------------------------------------------------------------------------
/img/xiaopaimengzouta_5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/img/xiaopaimengzouta_5.jpg
--------------------------------------------------------------------------------
/muxia_beating_fast.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/09/21
4 | */
5 | import { segment } from 'oicq';
6 | import BotCfg from '../../lib/config/config.js';
7 | import plugin from '../../lib/plugins/plugin.js';
8 |
9 | export class beatingFast extends plugin {
10 | constructor() {
11 | super({
12 | name: '速速挨打',
13 | dsc: '速速挨打',
14 | /** https://oicqjs.github.io/oicq/#events */
15 | event: 'message.group',
16 | priority: 1500,
17 | rule: [
18 | {
19 | /** 命令正则匹配 */
20 | reg: '^揍他$',
21 | /** 执行方法 */
22 | fnc: 'beatingFast',
23 | },
24 | {
25 | /** 命令正则匹配 */
26 | reg: '^拍拍$',
27 | /** 执行方法 */
28 | fnc: 'patPat',
29 | },
30 | ],
31 | });
32 | }
33 |
34 | /** 速速挨打 */
35 | async beatingFast(e) {
36 | //消息图片数组
37 | let messageImg = [
38 | 'xiaopaimengzouta.gif',
39 | 'xiaopaimengzouta_1.gif',
40 | 'xiaopaimengzouta_2.gif',
41 | 'xiaopaimengzouta_3.gif',
42 | 'xiaopaimengzouta_4.gif',
43 | 'xiaopaimengzouta_5.jpg',
44 | ];
45 | const message = e.message;
46 |
47 | //存储挨打人qq变量
48 | let atQq = getAtQq('1', e);
49 |
50 | if (atQq) {
51 | //获取项目运行路径
52 | const _path = process.cwd();
53 | //获取发送图片序号
54 | const imgIndex = rand(0, messageImg.length - 1);
55 |
56 | const text = '\n接受我的暴打';
57 | let msg = [
58 | //@用户
59 | segment.at(atQq),
60 | //文本消息
61 | text,
62 | //图片
63 | segment.image(`file:///${_path}/resources/img/${messageImg[imgIndex]}`),
64 | ];
65 | e.reply(msg);
66 | } else if (message.length == 1) {
67 | logger.info(`[速速挨打插件] 请选择需要@的人`);
68 | e.reply('请@一个人进行揍他操作');
69 | }
70 |
71 | //返回true 阻挡消息不再往下
72 | return true;
73 | }
74 |
75 | async patPat(e) {
76 | const message = e.message;
77 | //存储挨打人qq变量
78 | let atQq = getAtQq('2', e);
79 |
80 | if (atQq) {
81 | //获取项目运行路径
82 | const _path = process.cwd();
83 |
84 | const text = '\n进行一个拍的拍';
85 | let msg = [
86 | //@用户
87 | segment.at(atQq),
88 | //文本消息
89 | text,
90 | //图片
91 | segment.image(`file:///${_path}/resources/img/paipai.gif`),
92 | ];
93 | e.reply(msg);
94 | } else if (message.length == 1) {
95 | logger.info(`[速速挨打插件] 请选择需要@的人`);
96 | e.reply('请@一个人进行拍拍操作');
97 | }
98 |
99 | //返回true 阻挡消息不再往下
100 | return true;
101 | }
102 | }
103 |
104 | function getAtQq(funType, e) {
105 | let atQq;
106 | //获取发起人发送消息
107 | const message = e.message;
108 |
109 | //循环遍历发起人发送消息,获取挨打人qq号
110 | for (let i in message) {
111 | if (message[i].type == 'at') {
112 | if (message[i].qq == Bot.uin) {
113 | notBeatMsg(funType, '1', e);
114 | return;
115 | } else if (message[i].qq == BotCfg.masterQQ) {
116 | //上面if内,填写自己的qq,可以规避不挨打
117 | notBeatMsg(funType, '2', e);
118 | return;
119 | } else {
120 | atQq = message[i].qq;
121 | }
122 | }
123 | }
124 |
125 | return atQq;
126 | }
127 |
128 | function notBeatMsg(funType, type, e) {
129 | //获取项目运行路径
130 | const _path = process.cwd();
131 |
132 | let text;
133 | let funText;
134 |
135 | if (funType == '1') {
136 | funText = '揍';
137 | } else {
138 | funText = '拍';
139 | }
140 |
141 | if (type == '1') {
142 | text = `\n不可以${funText}我!`;
143 | } else if (type == '2') {
144 | text = `\n不可以${funText}我的主人!`;
145 | }
146 |
147 | let msg = [
148 | //@用户
149 | segment.at(e.user_id),
150 | //文本消息
151 | text,
152 | //图片
153 | segment.image(`file:///${_path}/resources/img/angri.png`),
154 | ];
155 | e.reply(msg);
156 | }
157 |
158 | function rand(m, n) {
159 | return Math.ceil(Math.random() * (n - m + 1) + m - 1);
160 | }
161 |
--------------------------------------------------------------------------------
/muxia_can_not_hit.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/09/16
4 | */
5 | import { segment } from 'oicq';
6 | import plugin from '../../lib/plugins/plugin.js';
7 |
8 | export class catNotHit extends plugin {
9 | constructor() {
10 | super({
11 | name: '不可以打人',
12 | dsc: '不可以打人',
13 | /** https://oicqjs.github.io/oicq/#events */
14 | event: 'message.group',
15 | priority: 1000,
16 | rule: [
17 | {
18 | /** 命令正则匹配 */
19 | reg: '^[\\s\\S]*(挨打|挨锤|揍他)$',
20 | /** 执行方法 */
21 | fnc: 'catNotHit',
22 | },
23 | ],
24 | });
25 | }
26 |
27 | async catNotHit(e) {
28 | //获取项目运行路径
29 | const _path = process.cwd();
30 |
31 | const text = '\n不可以打人,要和平';
32 | let msg = [
33 | //@用户
34 | segment.at(e.user_id),
35 | //文本消息
36 | text,
37 | //图片
38 | segment.image(`file:///${_path}/resources/img/hutaokeai.gif`),
39 | ];
40 | e.reply(msg);
41 |
42 | //返回true 阻挡消息不再往下
43 | return true;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/muxia_countdown.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2023/03/19
4 | */
5 | import { Group, segment } from 'icqq';
6 | import fetch from 'node-fetch';
7 | import schedule from 'node-schedule';
8 | import common from '../../lib/common/common.js';
9 | import plugin from '../../lib/plugins/plugin.js';
10 |
11 | /* 各位代表的意思 *-代表任意值 ?-不指定值,仅日期和星期域支持该字符。 (想了解更多,请自行搜索Cron表达式学习)
12 | * * * * * *
13 | ┬ ┬ ┬ ┬ ┬ ┬
14 | │ │ │ │ │ |
15 | │ │ │ │ │ └ 星期几,取值:0 - 7,其中 0 和 7 都表示是周日
16 | │ │ │ │ └─── 月份,取值:1 - 12
17 | │ │ │ └────── 日期,取值:1 - 31
18 | │ │ └───────── 时,取值:0 - 23
19 | │ └──────────── 分,取值:0 - 59
20 | └─────────────── 秒,取值:0 - 59(可选)
21 | */
22 | const pushTime = '0 30 7 * * ?';
23 |
24 | /**
25 | * 开启定时推送的群号,填写格式如下
26 | * ["374900636"];
27 | * 多个个群号填写如下:
28 | * ["374900636","374900636"];
29 | */
30 | const groupNumberList = [];
31 |
32 | //开启定时任务(需要关闭,注释此行即可
33 | dayPushCountdown();
34 |
35 | //高考日期
36 | const collegeEntranceTime = '06/07';
37 |
38 | export class countdown extends plugin {
39 | constructor() {
40 | super({
41 | name: '倒计时',
42 | dsc: '可以自定义添加各种倒计时服务',
43 | /** https://oicqjs.github.io/oicq/#events */
44 | event: 'message',
45 | priority: 1000,
46 | rule: [
47 | {
48 | /** 命令正则匹配 */
49 | reg: '^#?高考(倒计时)?$',
50 | /** 执行方法 */
51 | fnc: 'collegeEntranceCountdown',
52 | },
53 | ],
54 | });
55 | }
56 |
57 | async collegeEntranceCountdown(e) {
58 | sendCollegeEntranceCountdown(e);
59 | }
60 | }
61 |
62 | /** 定时推送 */
63 | function dayPushCountdown() {
64 | schedule.scheduleJob(pushTime, () => {
65 | for (var i = 0; i < groupNumberList.length; i++) {
66 | let group = Bot.pickGroup(groupNumberList[i]);
67 | sendCollegeEntranceCountdown(group);
68 | common.sleep(3000);
69 | }
70 | });
71 | }
72 |
73 | async function sendCollegeEntranceCountdown(e) {
74 | //获取项目运行路径
75 | const _path = process.cwd();
76 |
77 | let nowDate = getNowFormatDate();
78 | let endYear = (nowDate.month == 6 && nowDate.strDate > 8) || nowDate.month > 6 ? nowDate.year + 1 : nowDate.year;
79 |
80 | let nowStr = nowDate.year + '/' + nowDate.month + '/' + nowDate.strDate;
81 | let endStr = endYear + '/' + collegeEntranceTime;
82 |
83 | let days = getDaysBetween(nowStr, endStr);
84 |
85 | let text = '';
86 |
87 | if (nowDate.month < 6 || (nowDate.month == 6 && nowDate.strDate < 7)) {
88 | text += `距离${nowDate.year}年高考还有${days}天`;
89 | } else if (nowDate.month == 6 && (nowDate.strDate == 7 || nowDate.strDate == 8)) {
90 | text += nowDate.strDate == 7 ? `今天是${nowDate.year}年高考的第一天,` : `今天是${nowDate.year}年高考的第二天,`;
91 | text += `预祝本群各位考生,能在考场上超常发挥,考的全会,蒙的全对,考上自己心意的学校!`;
92 | } else if (nowDate.month < 8) {
93 | text += `${nowDate.year}年高考已经结束\n距离${endYear}年高考还有${days}天`;
94 | } else {
95 | text += `距离${endYear}年高考还有${days}天`;
96 | }
97 |
98 | if (nowDate.month != 6 && (nowDate.strDate != 7 || nowDate.strDate != 8)) {
99 | await getGoodSentence().then((res) => {
100 | text += '\n\n今日鸡汤:\n' + res;
101 | });
102 | }
103 |
104 | let msg = [
105 | //文本消息
106 | text,
107 | //图片
108 | segment.image(`file:///${_path}/resources/img/gaofenpenwu.png`),
109 | ];
110 |
111 | if (e instanceof Group) {
112 | e.sendMsg(msg);
113 | } else {
114 | //添加@成员
115 | msg.unshift(segment.at(e.user_id));
116 | e.reply(msg);
117 | }
118 |
119 | //返回true 阻挡消息不再往下
120 | return true;
121 | }
122 |
123 | //获取高考鸡汤
124 | async function getGoodSentence() {
125 | let pn = Math.round(Math.random() * 5);
126 | let url = `https://hanyu.baidu.com/hanyu/api/sentencelistv2?query=高考鸡汤&src_id=51328&pn=${pn}&ps=20`;
127 | let res = await fetch(url).catch((err) => logger.error(err));
128 |
129 | if (res.status != 200) {
130 | logger.error('[高考倒计时] 鸡汤获取失败');
131 | return '[高考倒计时] 鸡汤获取失败';
132 | }
133 | res = await res.json();
134 |
135 | let number = parseInt(Math.random() * 20 - 1);
136 |
137 | let returnBody = '';
138 |
139 | if (res.data.ret_array.length == 0 || res.data.ret_array[0].list.length < number + 1) {
140 | returnBody = getGoodSentence();
141 | return returnBody;
142 | }
143 |
144 | return res.data.ret_array[0].list[number].body[0];
145 | }
146 |
147 | //获取当前日期函数
148 | function getNowFormatDate() {
149 | let date = new Date(),
150 | year = date.getFullYear(), //获取完整的年份(4位)
151 | month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
152 | strDate = date.getDate(); // 获取当前日(1-31)
153 | if (month < 10) month = `0${month}`; // 如果月份是个位数,在前面补0
154 | if (strDate < 10) strDate = `0${strDate}`; // 如果日是个位数,在前面补0
155 |
156 | return { year: year, month: month, strDate: strDate };
157 | }
158 |
159 | /**
160 | * @param startDate 开始日期 yyyy-MM-dd
161 | * @param enDate 结束日期 yyyy-MM-dd
162 | * @returns {number} 两日期相差的天数
163 | */
164 | function getDaysBetween(startDate, enDate) {
165 | const sDate = Date.parse(startDate);
166 | const eDate = Date.parse(enDate);
167 | if (sDate > eDate) {
168 | return 0;
169 | }
170 | // 这个判断可以根据需求来确定是否需要加上
171 | if (sDate === eDate) {
172 | return 1;
173 | }
174 | const days = (eDate - sDate) / (1 * 24 * 60 * 60 * 1000);
175 | return days;
176 | }
177 |
--------------------------------------------------------------------------------
/muxia_duck_img.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/10/11
4 | */
5 | import fetch from 'node-fetch';
6 | import schedule from 'node-schedule';
7 | import { Group, segment } from 'oicq';
8 | import common from '../../lib/common/common.js';
9 | import plugin from '../../lib/plugins/plugin.js';
10 |
11 | /**
12 | * 定制群号 必须在这配置
13 | *
14 | * 开启定时推送的群号,填写格式如下
15 | * 单个群号填写如下:
16 | * ["374900636"];
17 | * 多个个群号填写如下:
18 | * ["374900636","374900636"];
19 | */
20 | const groupNumberList = [];
21 |
22 | /**
23 | * 配置文件
24 | * time 发送时间 单位小时 当前不支持单个的分钟修改
25 | * sendText 发送文本内容
26 | * imgType 发送图片类型 1-鸭鸭 2-猫猫 3-柴犬 4-鸟 不同时间段的图片可重复,按自己的喜好更改
27 | *
28 | * all 代表所有群的默认配置,如需定制单个群的发送时间、文本内容和配图
29 | * 请复制整个all,然后将all改为定制群号配置文件下方有个示例,按示例的样子配置即可
30 | * 定制群号 必须在上面配置
31 | *
32 | * 发送次数可以自定义,有几组数据就会发几次,只要你想,你可以每小时都发一次
33 | */
34 | const config = {
35 | all: [
36 | {
37 | time: 8,
38 | sendText: '早上好!快谢谢鸭鸭。',
39 | imgType: 1,
40 | },
41 | {
42 | time: 12,
43 | sendText: '中午好!快谢谢猫猫。',
44 | imgType: 2,
45 | },
46 | {
47 | time: 19,
48 | sendText: '晚上好!快谢谢柴犬。',
49 | imgType: 3,
50 | },
51 | {
52 | time: 21,
53 | sendText: '晚安好梦!快谢谢小鸟。',
54 | imgType: 4,
55 | },
56 | ],
57 | };
58 | //开启定时任务(需要关闭,注释此行即可
59 | openPush();
60 |
61 | //鸭鸭图url
62 | const duckUrl = 'https://random-d.uk/api/v2/random';
63 | //猫猫图url
64 | const catUrl = 'https://shibe.online/api/cats';
65 | //柴犬图url
66 | const shibesUrl = 'http://shibe.online/api/shibes';
67 | //小鸟图url
68 | const birdUrl = 'https://shibe.online/api/birds';
69 |
70 | export class duckImg extends plugin {
71 | constructor() {
72 | super({
73 | name: '鸭鸭照',
74 | dsc: '随机鸭图',
75 | /** https://oicqjs.github.io/oicq/#events */
76 | event: 'message.group',
77 | priority: 1000,
78 | rule: [
79 | {
80 | /** 命令正则匹配 */
81 | reg: '^#?(哎鸭|哎呀|aiya)$',
82 | /** 执行方法 */
83 | fnc: 'duckImg',
84 | },
85 | ],
86 | });
87 | }
88 |
89 | async duckImg(e) {
90 | getDuckImg(e);
91 |
92 | //返回true 阻挡消息不再往下
93 | return true;
94 | }
95 | }
96 |
97 | function openPush() {
98 | // 创建存储对象
99 | let pushEntityList = [];
100 |
101 | // 获取所有key,将需要推送群进行分组
102 | let group = new Array();
103 | for (let key in config) {
104 | group.push(key);
105 | }
106 |
107 | // 根据配置情况,组装对象
108 | if (group.length > 1) {
109 | let pushNumberList = groupNumberList.slice(0);
110 | for (let i in group) {
111 | if (group[i] != 'all') {
112 | let flag = pushNumberList.indexOf(group[i]);
113 | if (flag > -1) {
114 | pushNumberList.splice(flag, 1);
115 | }
116 |
117 | pushEntityList.push(
118 | {
119 | name: 'all',
120 | list: pushNumberList,
121 | },
122 | {
123 | name: group[i],
124 | list: [group[i]],
125 | },
126 | );
127 | }
128 | }
129 | } else {
130 | pushEntityList.push({
131 | name: group[0],
132 | list: groupNumberList,
133 | });
134 | }
135 |
136 | // 组装cron表达式
137 | for (let i in pushEntityList) {
138 | let sendConfig = config[pushEntityList[i].name];
139 |
140 | let time = new Array(4);
141 | for (let key in sendConfig) {
142 | time[key] = sendConfig[key].time;
143 | }
144 |
145 | let pushTime = `0 0 ${time.join(',')} * * ?`;
146 | pushEntityList[i].pushTime = pushTime;
147 | pushEntityList[i].sendConfig = sendConfig;
148 | }
149 |
150 | // 开启定时任务
151 | addPushTask(pushEntityList);
152 | }
153 |
154 | /** 定时推送 */
155 | function addPushTask(pushEntityList) {
156 | for (let index in pushEntityList) {
157 | let push = pushEntityList[index];
158 |
159 | schedule.scheduleJob(push.pushTime, () => {
160 | for (var i = 0; i < push.list.length; i++) {
161 | let group = Bot.pickGroup(push.list[i]);
162 |
163 | let hour = new Date().getHours();
164 |
165 | for (let q in push.sendConfig) {
166 | if (hour == push.sendConfig[q].time) {
167 | pushImgByType(group, push.sendConfig[q].sendText, push.sendConfig[q].imgType);
168 | }
169 | }
170 |
171 | common.sleep(3000);
172 | }
173 | });
174 | }
175 | }
176 |
177 | async function pushImgByType(e, sendText, typeId) {
178 | if (typeId == 1) {
179 | getDuckImg(e, sendText);
180 | } else if (typeId == 2) {
181 | getUrlImg(e, catUrl, sendText);
182 | } else if (typeId == 3) {
183 | getUrlImg(e, shibesUrl, sendText);
184 | } else if (typeId == 4) {
185 | getUrlImg(e, birdUrl, sendText);
186 | }
187 | }
188 |
189 | async function getDuckImg(e, sendText) {
190 | /** 鸭鸭图url */
191 | let res = await fetch(duckUrl).catch((err) => logger.error(err));
192 |
193 | if (res.status != 200) {
194 | logger.error('[鸭鸭照] 鸭图获取失败');
195 | if (e instanceof Group) {
196 | await e.sendMsg('[鸭鸭照] 鸭图获取失败');
197 | } else {
198 | await e.reply('[鸭鸭照] 鸭图获取失败');
199 | }
200 | return;
201 | }
202 | res = await res.json();
203 |
204 | let msg = [segment.image(res.url), res.message];
205 |
206 | if (e instanceof Group) {
207 | msg.unshift(sendText);
208 | e.sendMsg(msg);
209 | } else {
210 | //添加@成员
211 | msg.unshift(segment.at(e.user_id));
212 | e.reply(msg);
213 | }
214 | }
215 |
216 | async function getUrlImg(e, url, sendText) {
217 | let res = await (await fetch(url)).json();
218 | let imgUrl = res.toString();
219 |
220 | let msg = [segment.image(imgUrl)];
221 |
222 | if (e instanceof Group) {
223 | msg.unshift(sendText);
224 | e.sendMsg(msg);
225 | }
226 | }
227 |
--------------------------------------------------------------------------------
/muxia_get_60s_day_news.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/09/16
4 | */
5 | import schedule from 'node-schedule';
6 | import { Group, segment } from 'oicq';
7 | import common from '../../lib/common/common.js';
8 | import plugin from '../../lib/plugins/plugin.js';
9 |
10 | /* 各位代表的意思 *-代表任意值 ?-不指定值,仅日期和星期域支持该字符。 (想了解更多,请自行搜索Cron表达式学习)
11 | * * * * * *
12 | ┬ ┬ ┬ ┬ ┬ ┬
13 | │ │ │ │ │ |
14 | │ │ │ │ │ └ 星期几,取值:0 - 7,其中 0 和 7 都表示是周日
15 | │ │ │ │ └─── 月份,取值:1 - 12
16 | │ │ │ └────── 日期,取值:1 - 31
17 | │ │ └───────── 时,取值:0 - 23
18 | │ └──────────── 分,取值:0 - 59
19 | └─────────────── 秒,取值:0 - 59(可选)
20 | */
21 | const pushTime = '0 30 8 * * ?';
22 |
23 | /**
24 | * 开启定时推送的群号,填写格式如下
25 | * 单个群号填写如下:
26 | * ["374900636"];
27 | * 多个个群号填写如下:
28 | * ["374900636","374900636"];
29 | */
30 | const groupNumberList = [];
31 |
32 | //开启定时任务(需要关闭,注释此行即可
33 | dayPushTask();
34 |
35 | export class day60sNews extends plugin {
36 | constructor() {
37 | super({
38 | name: '60s读懂世界',
39 | dsc: '获取60s读懂世界的日报',
40 | /** https://oicqjs.github.io/oicq/#events */
41 | event: 'message.group',
42 | priority: 1000,
43 | rule: [
44 | {
45 | /** 命令正则匹配 */
46 | reg: '^#?60s日报$',
47 | /** 执行方法 */
48 | fnc: 'get60sDayNews',
49 | },
50 | ],
51 | });
52 | }
53 |
54 | async get60sDayNews(e) {
55 | send60sDayNews(e);
56 | }
57 | }
58 |
59 | /** 定时推送 */
60 | function dayPushTask() {
61 | schedule.scheduleJob(pushTime, () => {
62 | for (var i = 0; i < groupNumberList.length; i++) {
63 | let group = Bot.pickGroup(groupNumberList[i]);
64 | send60sDayNews(group);
65 | common.sleep(3000);
66 | }
67 | });
68 | }
69 |
70 | /** 发送60s日报 */
71 | async function send60sDayNews(e) {
72 | /** 60s日报url */
73 | // let url = `http://bjb.yunwj.top/php/tp/lj.php`;
74 | // let res = await fetch(url).catch((err) => logger.error(err));
75 |
76 | // if (res.status != 200) {
77 | // logger.error("[60s读懂世界] 日报获取失败");
78 | // if (e instanceof Group) {
79 | // await e.sendMsg("[60s读懂世界] 日报获取失败");
80 | // } else {
81 | // await e.reply("[60s读懂世界] 日报获取失败");
82 | // }
83 | // return;
84 | // }
85 | // res = await res.json();
86 |
87 | let url = `https://api.03c3.cn/api/zb`;
88 |
89 | let msg = [segment.image(url, false, 120)];
90 |
91 | if (e instanceof Group) {
92 | e.sendMsg(msg);
93 | } else {
94 | //添加@成员
95 | msg.unshift(segment.at(e.user_id));
96 | e.reply(msg);
97 | }
98 |
99 | //返回true 阻挡消息不再往下
100 | return true;
101 | }
102 |
--------------------------------------------------------------------------------
/muxia_get_day_news.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/09/16
4 | */
5 | import { createRequire } from 'module';
6 | import fetch from 'node-fetch';
7 | import schedule from 'node-schedule';
8 | import { Group, segment } from 'oicq';
9 | import common from '../../lib/common/common.js';
10 | import plugin from '../../lib/plugins/plugin.js';
11 | const require = createRequire(import.meta.url);
12 |
13 | /* 各位代表的意思 *-代表任意值 ?-不指定值,仅日期和星期域支持该字符。 (想了解更多,请自行搜索Cron表达式学习)
14 | * * * * * *
15 | ┬ ┬ ┬ ┬ ┬ ┬
16 | │ │ │ │ │ |
17 | │ │ │ │ │ └ 星期几,取值:0 - 7,其中 0 和 7 都表示是周日
18 | │ │ │ │ └─── 月份,取值:1 - 12
19 | │ │ │ └────── 日期,取值:1 - 31
20 | │ │ └───────── 时,取值:0 - 23
21 | │ └──────────── 分,取值:0 - 59
22 | └─────────────── 秒,取值:0 - 59(可选)
23 | */
24 | const pushTime = '0 30 9 * * ?';
25 |
26 | /**
27 | * 开启定时推送的群号,填写格式如下
28 | * 单个群号填写如下:
29 | * ["374900636"];
30 | * 多个个群号填写如下:
31 | * ["374900636","374900636"];
32 | */
33 | const groupNumberList = [];
34 |
35 | //开启定时任务(需要关闭,注释此行即可
36 | dayPushTask();
37 |
38 | /**
39 | * 访问https://mp.weixin.qq.com/并登录,
40 | * 从network的https://mp.weixin.qq.com/cgi-bin/home请求中获取cookie复制粘贴到下面
41 | */
42 | const cookie = '';
43 |
44 | export class dayNews extends plugin {
45 | constructor() {
46 | super({
47 | name: '今日日报',
48 | dsc: '获取易即今日的日报',
49 | /** https://oicqjs.github.io/oicq/#events */
50 | event: 'message.group',
51 | priority: 1000,
52 | rule: [
53 | {
54 | /** 命令正则匹配 */
55 | reg: '^#?今日日报$',
56 | /** 执行方法 */
57 | fnc: 'getDayNews',
58 | },
59 | ],
60 | });
61 | }
62 |
63 | async getDayNews(e) {
64 | sendDayNews(e);
65 | }
66 | }
67 |
68 | /** 定时推送 */
69 | function dayPushTask() {
70 | schedule.scheduleJob(pushTime, () => {
71 | for (var i = 0; i < groupNumberList.length; i++) {
72 | let group = Bot.pickGroup(groupNumberList[i]);
73 | sendDayNews(group);
74 | common.sleep(3000);
75 | }
76 | });
77 | }
78 |
79 | /** 发送日报 */
80 | async function sendDayNews(e) {
81 | let param = {
82 | headers: {
83 | method: 'get',
84 | referer: 'https://mp.weixin.qq.com/',
85 | Host: 'mp.weixin.qq.com',
86 | 'user-agent':
87 | 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
88 | Cookie: '',
89 | },
90 | };
91 |
92 | param.headers.Cookie = cookie;
93 |
94 | let token;
95 |
96 | /** 使用cookie登录获取token */
97 | let loginUrl = `https://mp.weixin.qq.com`;
98 | let loginRes = await fetch(loginUrl, param).catch((err) => logger.error(err));
99 |
100 | if (loginRes.status == 200 && loginRes.url.indexOf('?') == -1) {
101 | logger.error('[今日日报] 登录接口请求失败');
102 | await e.reply('[今日日报] 获取登录token失败,可能cookie失效,请重新配置cookie');
103 | return true;
104 | }
105 |
106 | let params = loginRes.url.split('?')[1].split('&');
107 | for (var item in params) {
108 | if (params[item].indexOf('token') == 0) {
109 | token = params[item].split('=')[1];
110 | }
111 | }
112 |
113 | if (!token) {
114 | logger.error('[今日日报] 用户cookie失效');
115 | await e.reply('[今日日报] cookie失效,请重新配置cookie');
116 | return true;
117 | }
118 |
119 | /** 用接口获取自定义公众号的fakeid */
120 | // // 公众号名字
121 | // let queryName = "易即今日";
122 |
123 | // let queryFakeIdUrl = `https://mp.weixin.qq.com/cgi-bin/searchbiz?action=search_biz&begin=0&count=5&lang=zh_CN&f=json&ajax=1&query=${queryName}&token=${token}`;
124 | // let fakeidRes = await fetch(queryFakeIdUrl, param).catch((err) => logger.error(err));
125 | // if (fakeidRes.status != 200) {
126 | // logger.error("[今日日报] 公众号查询接口失败");
127 | // await e.reply("[今日日报] 公众号查询接口失败");
128 | // return true;
129 | // }
130 |
131 | // fakeidRes = await fakeidRes.json();
132 | // let fakeid = fakeidRes.list[0].fakeid;
133 |
134 | // if (!fakeid) {
135 | // logger.error("[获取每日日报] 获取公众号id失败");
136 | // await e.reply("获取公众号id失败");
137 | // return true;
138 | // }
139 |
140 | /** 直接写死公众号fakeid */
141 | //易即今日公众号fakeid
142 | let fakeid = 'MjM5MTA3NTQwNQ==';
143 |
144 | /** 获取公众号推文 */
145 | let imgUrl = `https://mp.weixin.qq.com/cgi-bin/appmsg?action=list_ex&begin=0&count=5&type=9&lang=zh_CN&f=json&ajax=1&fakeid=${fakeid}&token=${token}`;
146 |
147 | let getImgRes = await fetch(imgUrl, param).catch((err) => logger.error(err));
148 |
149 | /** 判断接口是否请求成功 */
150 | if (getImgRes.status != 200) {
151 | logger.error('[今日日报] 获取日报消息失败');
152 | await e.reply('[今日日报] 获取日报消息失败');
153 | return true;
154 | }
155 |
156 | //获取推文url
157 | let link = '';
158 |
159 | getImgRes = await getImgRes.json();
160 | let msgList = getImgRes.app_msg_list;
161 |
162 | let date = new Date();
163 | const dayTitle = `今日简报(${date.getMonth() + 1}月${date.getDate()}日)`;
164 |
165 | for (const item in msgList) {
166 | if (msgList[item].title == dayTitle) {
167 | link = msgList[item].link;
168 | }
169 | }
170 |
171 | if (link == '') {
172 | logger.error('[今日日报] 获取日报url失败');
173 | await e.reply('[今日日报] 获取日报url失败');
174 | return true;
175 | }
176 |
177 | //截取页面内容发送消息(这部分借鉴的别人的代码,不是太懂原理)
178 | const puppeteer = require('puppeteer');
179 | const browser = await puppeteer.launch({
180 | headless: true,
181 | args: [
182 | '--disable-gpu',
183 | '--disable-dev-shm-usage',
184 | '--disable-setuid-sandbox',
185 | '--no-first-run',
186 | '--no-sandbox',
187 | '--no-zygote',
188 | '--single-process',
189 | ],
190 | });
191 | const page = await browser.newPage();
192 | await page.goto(link);
193 | await page.setViewport({
194 | width: 1080,
195 | height: 1920,
196 | });
197 |
198 | let msg = [
199 | segment.image(
200 | await page.screenshot({
201 | fullPage: true,
202 | }),
203 | ),
204 | ];
205 |
206 | if (e instanceof Group) {
207 | e.sendMsg(msg);
208 | } else {
209 | //添加@成员
210 | msg.unshift(segment.at(e.user_id));
211 | e.reply(msg);
212 | }
213 |
214 | await browser.close();
215 |
216 | //返回true 阻挡消息不再往下
217 | return true;
218 | }
219 |
--------------------------------------------------------------------------------
/muxia_hot_search.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/10/08
4 | */
5 | import fetch from 'node-fetch';
6 | import common from '../../lib/common/common.js';
7 | import plugin from '../../lib/plugins/plugin.js';
8 |
9 | export class hotSearch extends plugin {
10 | constructor() {
11 | super({
12 | name: '热搜榜',
13 | dsc: '微博热搜和知乎热搜',
14 | /** https://oicqjs.github.io/oicq/#events */
15 | event: 'message.group',
16 | priority: 1500,
17 | rule: [
18 | {
19 | /** 命令正则匹配 */
20 | reg: '^#?微博热搜$',
21 | /** 执行方法 */
22 | fnc: 'weibo',
23 | },
24 | {
25 | /** 命令正则匹配 */
26 | reg: '^#?知乎热搜$',
27 | /** 执行方法 */
28 | fnc: 'zhihu',
29 | },
30 | ],
31 | });
32 | }
33 |
34 | async weibo(e) {
35 | console.log('用户命令:', e.msg);
36 |
37 | //执行的逻辑功能
38 | let url = `http://api.weibo.cn/2/guest/search/hot/word`;
39 | let res = await fetch(url).catch((err) => logger.error(err));
40 |
41 | if (res.status != 200) {
42 | logger.error('[热搜榜] 微博热搜获取失败');
43 | await e.reply('[热搜榜] 微博热搜获取失败');
44 | return true;
45 | }
46 | res = await res.json();
47 | let data = res.data;
48 |
49 | let text = ['微博热搜榜'];
50 | let addText = '';
51 | for (let i = 1; i < data.length; i++) {
52 | addText = addText + i + '、' + data[i - 1].word;
53 |
54 | if (i % 5 == 0) {
55 | addText = addText.replace(/#/g, '');
56 | text.push(addText);
57 | addText = '';
58 | } else {
59 | addText = addText + '\n\n';
60 | }
61 | }
62 |
63 | e.reply(await common.makeForwardMsg(this.e, text, text[0]));
64 |
65 | //返回true 阻挡消息不再往下
66 | return true;
67 | }
68 |
69 | async zhihu(e) {
70 | console.log('用户命令:', e.msg);
71 |
72 | //执行的逻辑功能
73 | let url = `https://www.zhihu.com/api/v3/feed/topstory/hot-lists/total?limit=50&desktop=true`;
74 | let res = await fetch(url).catch((err) => logger.error(err));
75 |
76 | if (res.status != 200) {
77 | logger.error('[热搜榜] 知乎热搜获取失败');
78 | await e.reply('[热搜榜] 知乎热搜获取失败');
79 | return true;
80 | }
81 | res = await res.json();
82 | let data = res.data;
83 |
84 | let text = ['知乎热搜榜:'];
85 | let addText = '';
86 | for (let i = 1; i < data.length; i++) {
87 | addText = addText + i + '、' + data[i - 1].target.title;
88 |
89 | if (i % 5 == 0) {
90 | text.push(addText);
91 | addText = '';
92 | } else {
93 | addText = addText + '\n\n';
94 | }
95 | }
96 |
97 | e.reply(await common.makeForwardMsg(this.e, text, text[0]));
98 |
99 | //返回true 阻挡消息不再往下
100 | return true;
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/muxia_mute_commdity.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/09/16
4 | */
5 | import { segment } from 'oicq';
6 | import plugin from '../../lib/plugins/plugin.js';
7 |
8 | /**
9 | * 配置违禁词
10 | * 多个违禁词请用 | 隔开
11 | * 如:群主女装|给我色色
12 | */
13 | const forbiddenWord = '群主挨打';
14 |
15 | /**
16 | * 触发违禁词时 机器人的回复语句
17 | */
18 | const replyStatement = '不可以打群主,看我禁言你!';
19 |
20 | export class muteCommdity extends plugin {
21 | constructor() {
22 | super({
23 | name: '禁言套餐',
24 | dsc: '打群主就得禁言',
25 | /** https://oicqjs.github.io/oicq/#events */
26 | event: 'message.group',
27 | priority: 500,
28 | rule: [
29 | {
30 | /** 命令正则匹配 */
31 | reg: `^.*(${forbiddenWord}).*`,
32 | /** 执行方法 */
33 | fnc: 'muteCommdity',
34 | },
35 | {
36 | /** 命令正则匹配 */
37 | reg: '^#添加.*(群主).*$',
38 | /** 执行方法 */
39 | fnc: 'canNotAddEmoji',
40 | },
41 | ],
42 | });
43 | }
44 |
45 | /** 禁言套餐 */
46 | async muteCommdity(e) {
47 | //撤回不合规发言
48 | e.group.recallMsg(e.message_id);
49 | //项目路径
50 | const _path = process.cwd();
51 | //获取随机图片序号
52 | const imgIndex = rand(1, 4);
53 |
54 | //发送消息
55 | const text = `\n${replyStatement}`;
56 | let msg = [
57 | //@用户
58 | segment.at(e.user_id),
59 | //文本消息
60 | text,
61 | //图片
62 | segment.image(`file:///${_path}/resources/img/paimengkeai_${imgIndex}.png`),
63 | ];
64 | e.reply(msg);
65 |
66 | if (e.isGroup) {
67 | // 禁言群友 填写单位为秒s
68 | e.group.muteMember(e.user_id, 60);
69 | }
70 |
71 | //返回true 阻挡消息不再往下
72 | return true;
73 | }
74 |
75 | async canNotAddEmoji(e) {
76 | //撤回不合规发言
77 | e.group.recallMsg(e.message_id);
78 | //项目路径
79 | const _path = process.cwd();
80 |
81 | //发送消息
82 | const text = '\n不可以添加群主相关的表情';
83 | let msg = [
84 | //@用户
85 | segment.at(e.user_id),
86 | //文本消息
87 | text,
88 | //图片
89 | segment.image(`file:///${_path}/resources/img/angri.png`),
90 | ];
91 | e.reply(msg);
92 |
93 | //返回true 阻挡消息不再往下
94 | return true;
95 | }
96 | }
97 |
98 | //获取随机数方法
99 | function rand(m, n) {
100 | return Math.ceil(Math.random() * (n - m + 1) + m - 1);
101 | }
102 |
--------------------------------------------------------------------------------
/muxia_recall_bot_msg.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/09/16
4 | */
5 | import plugin from '../../lib/plugins/plugin.js';
6 |
7 | export class recallBotMsg extends plugin {
8 | constructor() {
9 | super({
10 | name: '撤回机器人消息',
11 | dsc: '回复机器人信息,让其自主撤回',
12 | /** https://oicqjs.github.io/oicq/#events */
13 | event: 'message.group',
14 | priority: 1000,
15 | rule: [
16 | {
17 | /** 命令正则匹配 */
18 | reg: '^撤回$',
19 | /** 执行方法 */
20 | fnc: 'recallBotMsg',
21 | },
22 | ],
23 | });
24 | }
25 |
26 | async recallBotMsg(e) {
27 | if (e.atBot) {
28 | if (e.source) {
29 | e.group.recallMsg(e.source.seq, e.source.rand);
30 | } else {
31 | e.reply('请回复需要撤回消息');
32 | }
33 |
34 | if (e.group.is_admin && e.source.role != 'owner') {
35 | e.group.recallMsg(e.message_id);
36 | }
37 | } else {
38 | e.reply('请回复需要撤回消息');
39 | }
40 |
41 | //返回true 阻挡消息不再往下
42 | return true;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/muxia_repeater.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/09/16
4 | */
5 | import { segment } from 'oicq';
6 | import plugin from '../../lib/plugins/plugin.js';
7 |
8 | //复读阈值
9 | const repeaterThreshold = 3;
10 | //缓存存储时间 s为单位
11 | const redisTime = 60 * 15;
12 |
13 | const redisKeyPrefix = 'muxia:plugin:autoRepeater:';
14 |
15 | export class autoRepeater extends plugin {
16 | constructor() {
17 | super({
18 | name: '自动复读',
19 | dsc: '检测群聊内容,当出现多次内容后,自动进行复读',
20 | /** https://oicqjs.github.io/oicq/#events */
21 | event: 'message.group',
22 | priority: 60000,
23 | rule: [
24 | {
25 | /** 命令正则匹配 */
26 | reg: '^[\\s\\S]*$',
27 | /** 执行方法 */
28 | fnc: 'autoRepeater',
29 | },
30 | ],
31 | });
32 | }
33 |
34 | async autoRepeater(e) {
35 | if (e.message.length > 1) {
36 | return;
37 | }
38 |
39 | let msg = e.message[0];
40 |
41 | if (msg.type == 'image') {
42 | let redisKey = redisKeyPrefix + e.group_id + msg.file;
43 |
44 | let redisMsg = JSON.parse(await redis.get(redisKey));
45 | if (redisMsg) {
46 | redis.setEx(redisKey, redisTime, JSON.stringify({ count: redisMsg.count + 1, imgUrl: msg.url }));
47 | } else {
48 | redis.setEx(redisKey, redisTime, JSON.stringify({ count: 1, imgUrl: msg.url }));
49 | }
50 |
51 | redisMsg = JSON.parse(await redis.get(redisKey));
52 | if (redisMsg.count >= repeaterThreshold) {
53 | e.reply(segment.image(redisMsg.imgUrl));
54 | redis.del(redisKey);
55 | }
56 | } else if (msg.type == 'text') {
57 | let redisKey = redisKeyPrefix + e.group_id + msg.text;
58 |
59 | let redisMsg = JSON.parse(await redis.get(redisKey));
60 | if (redisMsg) {
61 | redis.setEx(redisKey, redisTime, JSON.stringify({ count: redisMsg.count + 1, sendText: msg.text }));
62 | } else {
63 | redis.setEx(redisKey, redisTime, JSON.stringify({ count: 1, sendText: msg.text }));
64 | }
65 |
66 | redisMsg = JSON.parse(await redis.get(redisKey));
67 | if (redisMsg.count >= repeaterThreshold) {
68 | e.reply(redisMsg.sendText);
69 | redis.del(redisKey);
70 | }
71 | }
72 |
73 | return false;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/pluginHelp/animal.md:
--------------------------------------------------------------------------------
1 | # 动物使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | 使用 **吸猫** **柴犬** **来只鸟** 主动触发,获取对应动物图片
6 |
7 | 
8 |
9 | 
10 |
11 | 
12 |
--------------------------------------------------------------------------------
/pluginHelp/beating_fast.md:
--------------------------------------------------------------------------------
1 | # 速速挨打使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | @一个群成员并携带 **揍他** / **拍拍** 进行操作
6 |
7 | 
8 |
9 | 
10 |
11 | ## 注意事项
12 |
13 | **因为本插件需要用到项目 img 目录下的图片进行信息发送,所以本插件,就必须将 img 下的文件放到指定位置**
14 |
--------------------------------------------------------------------------------
/pluginHelp/can_not_hit.md:
--------------------------------------------------------------------------------
1 | # 不可以打人使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | 当群成员发言中出现 **挨打** / **挨锤** / **揍他** 进行语言提示制止
6 |
7 | 
8 |
9 | ## 注意事项
10 |
11 | **因为本插件需要用到项目 img 目录下的图片进行信息发送,所以本插件,就必须将 img 下的文件放到指定位置**
12 |
--------------------------------------------------------------------------------
/pluginHelp/countdown.md:
--------------------------------------------------------------------------------
1 | # 倒计时使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | 使用 **高考** **高考倒计时** 主动触发
6 |
7 | 可配置定时触发,配置方法参考下面的配置指南
8 |
9 | ## 配置指南
10 |
11 | #### 重要提示
12 |
13 | **以下所有操作都是在,打开项目里面的 `muxia_countdown.js` 文件前提下进行操作的**
14 |
15 | - 下图为修改定时任务的触发时间的代码
16 |
17 | 
18 |
19 | - 下图为设置定时任务推送群号的代码
20 |
21 | 
22 |
23 | * 下图为定时任务的开关
24 |
25 | 开启状态
26 |
27 | 
28 |
29 | 关闭状态
30 |
31 | 
32 |
33 | ## 注意事项
34 |
35 | **因为本插件需要用到项目 img 目录下的图片进行信息发送,所以本插件,就必须将 img 下的文件放到指定位置**
--------------------------------------------------------------------------------
/pluginHelp/duck_img.md:
--------------------------------------------------------------------------------
1 | # 鸭鸭照使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | 使用 **哎鸭** / **哎呀** / **aiya** 主动触发,支持主动进行 **早上好/中午好/晚上好/晚安鸭** 问好
6 |
7 | 并且问好能自行配置,具体看下面的配置指南
8 |
9 | 如果需要使用问好功能,需要进行配置操作,参考下发的配置指南
10 |
11 | ## 配置指南
12 |
13 | #### 重要提示
14 |
15 | **以下所有操作都是在,打开项目里面的 `muxia_duck_img.js` 文件前提下进行操作的**
16 |
17 | - 下面为设置定时任务推送群号的代码
18 |
19 | **定制群号 必须在这配置**
20 |
21 | ```js
22 | /**
23 | * 定制群号 必须在这配置
24 | *
25 | * 开启定时推送的群号,填写格式如下
26 | * 单个群号填写如下:
27 | * ["374900636"];
28 | * 多个个群号填写如下:
29 | * ["374900636","374900636"];
30 | */
31 | const groupNumberList = [];
32 | ```
33 |
34 | - 下面为定时任务的开关
35 |
36 | > 在文件中找到`openPush`方法
37 |
38 | 开启状态
39 |
40 | ```js
41 | //开启定时任务(需要关闭,注释此行即可
42 | openPush();
43 | ```
44 |
45 | 关闭状态
46 |
47 | ```js
48 | //开启定时任务(需要关闭,注释此行即可
49 | //openPush();
50 | ```
51 |
52 | - 下面为自定义配置核心部分
53 |
54 | 快速指南:
55 |
56 | - 全部群共用一个配置,这样操作
57 |
58 | 最基础的配置文件就是下面的样子
59 | **不能随意修改**
60 | **随意修改造成的bug自行负责!!!**
61 | ```js
62 | const config = {
63 | all: [
64 | {
65 | // time 发送时间 单位小时 当前不支持单个的分钟修改
66 | time: 8,
67 | // sendText 发送文本内容
68 | sendText: "早上好!快谢谢鸭鸭。",
69 | // imgType 发送图片类型 1-鸭鸭 2-猫猫 3-柴犬 4-鸟 不同时间段的图片可重复,按自己的喜好更改
70 | imgType: 1
71 | }
72 | ]
73 | };
74 | ```
75 |
76 | 下面的为单次发送的配置,如果想新增发送次数,将下面的复制一份在上面的`[]`中,多个直接用`,`分割
77 | **用英文符号的`,`**
78 | **用英文符号的`,`**
79 | **用英文符号的`,`**
80 | ```js
81 | {
82 | // time 发送时间 单位小时 当前不支持单个的分钟修改
83 | time: 8,
84 | // sendText 发送文本内容
85 | sendText: "早上好!快谢谢鸭鸭。",
86 | // imgType 发送图片类型 1-鸭鸭 2-猫猫 3-柴犬 4-鸟 不同时间段的图片可重复,按自己的喜好更改
87 | imgType: 1
88 | }
89 | ```
90 |
91 | - 一部分群用通用配置,单独一两个群独立配置,这样操作
92 | 首先`all:[]`下面的配置是通用配置
93 | 当你需要为群单独配置的时候,请编写一个`群号:[]`的配置与`all:[]`在同一级,如下面的代码所示,添加发送次数和上面相同,参考即可
94 |
95 | 另外单独的群号,必须在`const groupNumberList = [];`中配置
96 | ```js
97 | const config = {
98 | all: [
99 | {
100 | // time 发送时间 单位小时 当前不支持单个的分钟修改
101 | time: 8,
102 | // sendText 发送文本内容
103 | sendText: "早上好!快谢谢鸭鸭。",
104 | // imgType 发送图片类型 1-鸭鸭 2-猫猫 3-柴犬 4-鸟 不同时间段的图片可重复,按自己的喜好更改
105 | imgType: 1
106 | }
107 | ],
108 | 326615777: [
109 | {
110 | time: 10, // 10点还早上好???
111 | sendText: "早起的鸟儿有虫吃!!!",
112 | imgType: 4
113 | }
114 | ]
115 | };
116 | ```
117 |
--------------------------------------------------------------------------------
/pluginHelp/get_60s_day_news.md:
--------------------------------------------------------------------------------
1 | # 60s 日报使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | 使用 **60s 日报** 主动触发
6 |
7 | 可配置定时触发,配置方法参考下面的配置指南
8 |
9 | ## 配置指南
10 |
11 | #### 重要提示
12 |
13 | **以下所有操作都是在,打开项目里面的 `muxia_get_60s_day_news.js` 文件前提下进行操作的**
14 |
15 | - 下图为修改定时任务的触发时间的代码
16 |
17 | 
18 |
19 | - 下图为设置定时任务推送群号的代码
20 |
21 | 
22 |
23 | * 下图为定时任务的开关
24 |
25 | 开启状态
26 |
27 | 
28 |
29 | 关闭状态
30 |
31 | 
32 |
--------------------------------------------------------------------------------
/pluginHelp/get_day_news.md:
--------------------------------------------------------------------------------
1 | # 今日日报使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | 使用 **今日日报** 主动触发
6 |
7 | 可配置定时触发,配置方法参考下面的配置指南
8 |
9 | ## 配置指南
10 |
11 | #### 重要提示
12 |
13 | **以下所有操作都是在,打开项目里面的 `muxia_get_day_news.js` 文件前提下进行操作的**
14 |
15 | - 下图为修改定时任务的触发时间的代码
16 |
17 | 
18 |
19 | - 下图为设置定时任务推送群号的代码
20 |
21 | 
22 |
23 | * 下图为定时任务的开关
24 |
25 | 开启状态
26 |
27 | 
28 |
29 | 关闭状态
30 |
31 | 
32 |
33 | ### cookie 配置教程
34 |
35 | #### 经过测试,cookie 的过期时间大致为三天,目前没找到更好的方法延长 cookie 时间,如果有好方法,请联系我
36 |
37 | 1. 访问[微信公众号](https://mp.weixin.qq.com/)官网
38 |
39 | 
40 |
41 | 2. 按 f12 打开浏览器控制台,点击 Network
42 |
43 | 
44 |
45 | 3. 登录微信账号
46 | 登录成功后,在 network 页面找到下图标注的请求,点击
47 |
48 | 
49 |
50 | 4. 找到 cookie 选项,右键 copy value
51 |
52 | 
53 |
54 | 5. 粘贴到`my_plugin_get_day_news.js`插件的图示位置
55 |
56 | 
57 |
--------------------------------------------------------------------------------
/pluginHelp/guessingGame.md:
--------------------------------------------------------------------------------
1 | # 猜拳游戏使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | ### 此插件有封号风险,请酌情使用
6 |
7 | 使用 **开始决斗** 主动触发, **给我色图** 有彩蛋
8 |
9 | 
10 |
11 | 彩蛋各位自行探索
12 |
--------------------------------------------------------------------------------
/pluginHelp/hot_search.md:
--------------------------------------------------------------------------------
1 | # 热搜榜使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | 使用 **微博热搜** / **知乎热搜** 主动触发
6 |
7 | 
8 |
9 | 
10 |
--------------------------------------------------------------------------------
/pluginHelp/imgs/animal/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/animal/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/animal/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/animal/2.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/animal/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/animal/3.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/beatingFast/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/beatingFast/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/beatingFast/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/beatingFast/2.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/canNotHit/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/canNotHit/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/countdown/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/countdown/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/countdown/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/countdown/2.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/dayNews/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/dayNews/1.jpg
--------------------------------------------------------------------------------
/pluginHelp/imgs/dayNews/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/dayNews/2.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/dayNews/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/dayNews/3.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/dayNews/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/dayNews/4.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/dayNews/help_img_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/dayNews/help_img_1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/dayNews/help_img_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/dayNews/help_img_2.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/dayNews/help_img_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/dayNews/help_img_3.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/dayNews/help_img_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/dayNews/help_img_4.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/dayNews/help_img_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/dayNews/help_img_5.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/duckImg/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/duckImg/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/duckImg/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/duckImg/2.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/duckImg/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/duckImg/3.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/duckImg/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/duckImg/4.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/guessingGame/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/guessingGame/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/hotSearch/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/hotSearch/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/hotSearch/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/hotSearch/2.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/muteCommdity/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/muteCommdity/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/muteCommdity/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/muteCommdity/2.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/pixiv/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/pixiv/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/pixiv/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/pixiv/2.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/pixiv/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/pixiv/3.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/recallBotMsg/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/recallBotMsg/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/repeater/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/repeater/1.png
--------------------------------------------------------------------------------
/pluginHelp/imgs/repeater/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/pluginHelp/imgs/repeater/2.png
--------------------------------------------------------------------------------
/pluginHelp/mute_commdity.md:
--------------------------------------------------------------------------------
1 | # 禁言套餐使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | 自行配置违禁词,触发违禁词进行禁言操作,并撤回违禁发言(撤回违禁发言需要管理员/群主权限)
6 |
7 | 
8 |
9 | > 演示图片由于我是群主,所以禁言和撤回消息都没权利(代码是实现了对应操作的)
10 |
11 | 自行配置违禁词教程如下
12 |
13 | ## 配置指南
14 |
15 | #### 重要提示
16 |
17 | **以下所有操作都是在,打开项目里面的 `muxia_mute_commdity.js` 文件前提下进行操作的**
18 |
19 | 
20 |
21 | ## 注意事项
22 |
23 | **因为本插件需要用到项目 img 目录下的图片进行信息发送,所以本插件,就必须将 img 下的文件放到指定位置**
24 |
--------------------------------------------------------------------------------
/pluginHelp/pixiv.md:
--------------------------------------------------------------------------------
1 | # 色色使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | ### 此插件有封号风险,请酌情使用
6 |
7 | 使用 **来点色图** 主动触发,拥有图文开关默认为文字模式
8 |
9 | 
10 |
11 | > 获取的图片会在一定时间内撤回
12 |
13 | 使用 #设置图片数量[数量] 修改单次返回的图片数量,默认返回三张
14 |
15 | 使用 #开启 18 群聊 / #开启 18 私聊 开启 18 开关
16 |
17 | 使用 #关闭 18 群聊 / #关闭 18 私聊 关闭 18 开关
18 |
19 | 群聊私聊相互独立
20 |
21 | **上述三个设置,在重启 bot 后需要会失效重新设置,需要永久修改,请自行修改`refactorCode/pixiv.js`文件,有注解标注位置**
22 |
23 | ## 配置指南
24 |
25 | #### 重要提示
26 |
27 | **以下所有操作都是在,打开项目里面的 `refactorCode/pixiv.js` 文件前提下进行操作的**
28 |
29 | 18开关
30 |
31 | * 0-代表关
32 | * 1-代表开
33 |
34 | 撤回时间
35 |
36 | 单位为秒(s),0为不撤回
37 |
38 | 
39 |
40 | 2022-10-22 新增图文模式切换开关
41 |
42 | 
43 |
44 | * 0-代表文字模式
45 | * 1-代表图片模式
46 |
47 | > 文字模式比图片模式发送成功率更高,机器人被封号的可能性越低,根据自己的需求选择
--------------------------------------------------------------------------------
/pluginHelp/recall_bot_msg.md:
--------------------------------------------------------------------------------
1 | # 撤回机器人消息使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | 回复机器人消息,并附带 **撤回** 字样(如果机器人的权限够大,还能顺便撤回回复消息)
6 |
7 | 
8 |
--------------------------------------------------------------------------------
/pluginHelp/repeater.md:
--------------------------------------------------------------------------------
1 | # 自动复读使用帮助文档
2 |
3 | ## 使用方法
4 |
5 | 根据群友发言随机复读
6 |
7 | 
8 |
9 | ## 配置指南
10 |
11 | #### 重要提示
12 |
13 | **以下所有操作都是在,打开项目里面的 `muxia_repeater.js` 文件前提下进行操作的**
14 |
15 | - 下图为修改复读阈值的代码
16 |
17 | 
18 |
19 | 复读阈值:即重复内容出现多少次,机器人就会触发复读操作
20 |
21 | 上图的复读阈值代表的意思是,重复内容出现三次,机器人就会自动复读一次
22 |
23 | ps:机器人没办法检测高频发言
24 |
--------------------------------------------------------------------------------
/readme/e_.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/readme/e_.ico
--------------------------------------------------------------------------------
/readme/project_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MuXia-0326/YunzaiBotJsPluginMuXia/d189b779f8a3823b7c954dacf9f433e817316ab4/readme/project_logo.png
--------------------------------------------------------------------------------
/refactorCode/animal.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/10/11
4 | */
5 | import fetch from 'node-fetch';
6 | import { segment } from 'oicq';
7 | import plugin from '../../lib/plugins/plugin.js';
8 |
9 | /**
10 | * 此插件根据 https://gitee.com/koinori/Icepray-plugin 的 cat.js 源码进行更改优化
11 | */
12 |
13 | export class animal extends plugin {
14 | constructor() {
15 | super({
16 | name: '云吸猫',
17 | dsc: '随机猫猫',
18 | event: 'message',
19 | priority: 50,
20 | rule: [
21 | {
22 | reg: '^#*吸猫$',
23 | fnc: 'cat',
24 | },
25 | {
26 | reg: '^#*柴犬$',
27 | fnc: 'shibe',
28 | },
29 | {
30 | reg: '^#*来只鸟$',
31 | fnc: 'bird',
32 | },
33 | ],
34 | });
35 | }
36 |
37 | async cat(e) {
38 | let res = await (await fetch('https://shibe.online/api/cats')).json();
39 | let url = res.toString();
40 | e.reply(segment.image(url));
41 |
42 | let msg = ['猫图加载中...'];
43 | this.e.reply(msg);
44 | return true;
45 | }
46 |
47 | async shibe(e) {
48 | let res = await (await fetch('http://shibe.online/api/shibes')).json();
49 | let url = res.toString();
50 | e.reply(segment.image(url));
51 |
52 | let msg = ['柴犬加载中...'];
53 | this.e.reply(msg);
54 | return true;
55 | }
56 |
57 | async bird(e) {
58 | let res = await (await fetch('https://shibe.online/api/birds')).json();
59 | let url = res.toString();
60 | e.reply(segment.image(url));
61 |
62 | let msg = ['鸟图加载中...'];
63 | this.e.reply(msg);
64 | return true;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/refactorCode/guessingGame.js:
--------------------------------------------------------------------------------
1 | /*
2 | * @Author: MuXia
3 | * @Date: 2022/10/12
4 | */
5 | import fetch from 'node-fetch';
6 | import { segment } from 'oicq';
7 | import plugin from '../../lib/plugins/plugin.js';
8 |
9 | /**
10 | * 此插件根据 https://github.com/SmallK111407/earth-k-plugin 的 dawo.js 源码进行更改优化
11 | */
12 |
13 | let botOut;
14 | let botOutText;
15 | let userOut;
16 |
17 | let startFlag = 0;
18 | let duelUser;
19 |
20 | const url_1 = 'https://iw233.cn/API/Random.php';
21 | const url_2 = 'http://ovooa.com/API/meizi/api.php?type=image';
22 |
23 | //给我色图专用url
24 | const seseUrl = `https://api.lolicon.app/setu/v2?proxy=i.pixiv.re&r18=0&size=original`;
25 |
26 | //默认使用二次元url
27 | let urlIndex = url_1;
28 |
29 | //redis相关变量
30 | const redisTime = 60 * 15;
31 | const redisKeyPrefix = 'muxia:plugin:guessingGame:';
32 |
33 | export class guessingGame extends plugin {
34 | constructor() {
35 | super({
36 | name: '猜拳游戏',
37 | dsc: '猜拳游戏,赢了有色图,输了禁言',
38 | /** https://oicqjs.github.io/oicq/#events */
39 | event: 'message',
40 | /** 优先级,数字越小等级越高 */
41 | priority: 1200,
42 | rule: [
43 | {
44 | reg: '^#?开始决斗$',
45 | fnc: 'mora',
46 | },
47 | {
48 | reg: '^石头|剪刀|布$',
49 | fnc: 'doMora',
50 | },
51 | {
52 | reg: '^#?给我色图$',
53 | fnc: 'force',
54 | },
55 | {
56 | reg: '^#猜拳游戏切换图源$',
57 | fnc: 'updateImgUrl',
58 | },
59 | ],
60 | });
61 | }
62 |
63 | async mora(e) {
64 | if (startFlag == 1) {
65 | await this.reply('\n小派蒙没办法同时跟多个人决斗', false, { at: true });
66 | return;
67 | } else {
68 | startFlag = 1;
69 | duelUser = e.user_id;
70 | }
71 |
72 | botOut = Math.floor(Math.random() * 3);
73 | if (botOut == 0) {
74 | botOutText = '我出石头';
75 | } else if (botOut == 1) {
76 | botOutText = '我出剪刀';
77 | } else if (botOut == 2) {
78 | botOutText = '我出布';
79 | }
80 |
81 | /** 回复 */
82 | await e.reply('\n给你20秒,跟我来把猜拳,赢了奖励,输了禁言!你先发,石头,剪刀,布,出吧', false, { at: true });
83 |
84 | setTimeout(function () {
85 | if (startFlag == 1) {
86 | e.reply('\n20秒已过,还不出,给我寄!', false, { at: true });
87 | e.group.muteMember(duelUser, 10);
88 | startFlag = 0;
89 | duelUser = '';
90 | }
91 | }, 20 * 1000);
92 | }
93 |
94 | async doMora(e) {
95 | if (duelUser != e.user_id) {
96 | return;
97 | }
98 |
99 | if (e.msg == '石头') {
100 | userOut = 0;
101 | } else if (e.msg == '剪刀') {
102 | userOut = 1;
103 | } else if (e.msg == '布') {
104 | userOut = 2;
105 | } else {
106 | e.reply(`能不能好好玩游戏!请重新开始决斗`);
107 | return;
108 | }
109 | sendResult(e);
110 | }
111 |
112 | async force(e) {
113 | let delMsg = false;
114 | let mute = false;
115 | if (this.e.group.is_admin && this.e.sender.role != 'owner') {
116 | delMsg = true;
117 | }
118 | let redisKey = redisKeyPrefix + e.group_id + e.sender.user_id;
119 |
120 | let redisMsg = JSON.parse(await redis.get(redisKey));
121 | if (redisMsg) {
122 | redis.setEx(redisKey, redisTime, JSON.stringify({ count: redisMsg.count + 1 }));
123 | } else {
124 | redis.setEx(redisKey, redisTime, JSON.stringify({ count: 1 }));
125 | }
126 |
127 | redisMsg = JSON.parse(await redis.get(redisKey));
128 |
129 | console.log(redisMsg);
130 |
131 | let msgList = [];
132 | if (redisMsg.count == 1) {
133 | msgList.push(`\n跟我进行决斗,赢了才能获取色图`);
134 | } else if (redisMsg.count == 2) {
135 | msgList.push(`\n我看你是在为难我小派蒙,快去发起决斗`);
136 | } else if (redisMsg.count == 3) {
137 | mute = true;
138 | if (!delMsg && mute) {
139 | msgList.push([segment.at(e.user_id), `\n你为什么就这样执迷不悟呢,看来只能给你点教训了`]);
140 | msgList.push(`可恶小派蒙为什么没有禁言权限啊!!`);
141 | } else {
142 | msgList.push(`\n你为什么就这样执迷不悟呢,看来只能给你点教训了`);
143 | e.group.muteMember(e.user_id, 60);
144 | }
145 | } else if (redisMsg.count == 4) {
146 | msgList.push([segment.at(e.user_id), `\n哎鸭,你怎么还死缠烂打啊,算了,看在你这么乞求的份上就给你看一眼`]);
147 |
148 | let res = await (await fetch(seseUrl)).json();
149 | msgList.push(segment.flash(res.data[0].urls.original));
150 |
151 | redis.del(redisKey);
152 | } else if (redisMsg.count > 4) {
153 | redis.del(redisKey);
154 | return;
155 | }
156 |
157 | if (msgList.length > 1) {
158 | for (let i in msgList) {
159 | e.reply(msgList[i]);
160 | }
161 | } else {
162 | e.reply(msgList, false, { at: true });
163 | }
164 | }
165 |
166 | async updateImgUrl(e) {
167 | let urlText;
168 | if (urlIndex == url_1) {
169 | urlText = '真人';
170 | urlIndex = url_2;
171 | } else if (urlIndex == url_2) {
172 | urlText = '二次元';
173 | urlIndex = url_1;
174 | }
175 | e.reply(`切换为${urlText}图源`);
176 | }
177 | }
178 |
179 | async function sendResult(e) {
180 | if (botOut == userOut) {
181 | e.reply(`${botOutText},平局,饶你一回`);
182 | }
183 | if ((botOut == 1 && userOut == 0) || (botOut == 2 && userOut == 1) || (botOut == 0 && userOut == 2)) {
184 | let imgs = await fetch(urlIndex).catch((err) => logger.error(err));
185 | let msg = [`${botOutText},我输了,给你张涩图吧。快谢谢我!`, segment.image(imgs.url)];
186 | e.reply(msg);
187 | }
188 | if ((botOut == 2 && userOut == 0) || (botOut == 0 && userOut == 1) || (botOut == 1 && userOut == 2)) {
189 | e.reply(`${botOutText},你输了,给我寄!`);
190 | e.group.muteMember(e.user_id, 30);
191 | }
192 |
193 | startFlag = 0;
194 | duelUser = '';
195 | return;
196 | }
197 |
--------------------------------------------------------------------------------
/refactorCode/pixiv.js:
--------------------------------------------------------------------------------
1 | import fetch from 'node-fetch';
2 | import { segment } from 'oicq';
3 | import common from '../../lib/common/common.js';
4 | import plugin from '../../lib/plugins/plugin.js';
5 |
6 | /**
7 | * 此插件根据 https://github.com/SmallK111407/earth-k-plugin 的 sese.js 源码进行更改优化
8 | */
9 |
10 | //图文模式切换 变量
11 | let isSendImgFlag = 0;
12 |
13 | //群聊18开关
14 | let r18 = 0;
15 | //私聊18开关
16 | let r18Master = 0;
17 | //单次发送的图片数
18 | let sl = 3;
19 | //撤回时间s为单位
20 | let delMsg = 90;
21 |
22 | let url = '';
23 | let msgRes = [];
24 | let delMsgIdList = [];
25 |
26 | export class pixiv extends plugin {
27 | constructor() {
28 | super({
29 | /** 功能名称 */
30 | name: '色色',
31 | /** 功能描述 */
32 | dsc: '隐藏色色',
33 | /** https://oicqjs.github.io/oicq/#events */
34 | event: 'message',
35 | /** 优先级,数字越小等级越高 */
36 | priority: 1200,
37 | rule: [
38 | {
39 | reg: '^#?来点色图.*$',
40 | fnc: 'getHImg',
41 | },
42 | {
43 | reg: '^#设置图片数量(.*)|#开启18(.*)$|#关闭18(.*)$',
44 | fnc: 'settings',
45 | },
46 | ],
47 | });
48 | }
49 |
50 | /** 来点色图 */
51 | async getHImg(e) {
52 | if (e.isGroup && e.group.is_admin && e.sender.role != 'owner') {
53 | delMsgIdList.push(e.message_id);
54 | }
55 | /** 设置上下文,后续接收到内容会执行getKeyword方法 */
56 | this.setContext('getKeyword');
57 | /** 回复 */
58 | await this.reply('\n请回复 随机 或 关键词 ,关键词有多个,请使用 | 分割\n例如:少女|可爱', false, {
59 | at: true,
60 | recallMsg: delMsg,
61 | });
62 | }
63 |
64 | /** 来点色图后续 */
65 | getKeyword() {
66 | this.e.reply('小派蒙正在为您寻找,你想要的图片,请稍等!', false, { recallMsg: delMsg });
67 | if (this.e.isGroup) {
68 | if (this.e.group.is_admin && this.e.sender.role != 'owner') {
69 | delMsgIdList.push(this.e.message_id);
70 | }
71 | sendPixivImg(this.e);
72 | } else if (this.e.isMaster & this.e.isPrivate) {
73 | sendPixivImg(this.e);
74 | } else if (this.e.isPrivate) {
75 | this.e.reply('不可以私聊涩涩哦');
76 | }
77 | /** 结束上下文 */
78 | this.finish('getKeyword');
79 | }
80 |
81 | async settings(e) {
82 | if (e.isMaster) {
83 | if (e.msg.includes('#设置图片数量')) {
84 | let keyword = e.msg.replace('#设置图片数量', '');
85 | sl = Number(keyword);
86 | e.reply('当前返回' + keyword + '张图');
87 | }
88 |
89 | if (e.msg.includes('#开启18')) {
90 | let keyword = e.msg.replace('#开启18', '');
91 | if (keyword.length == 0) {
92 | e.reply(`请在后面跟进群聊,还是私聊\n我看你是在为难我小派蒙`);
93 | return;
94 | }
95 |
96 | e.reply(`${keyword}已开启R18模式,请注意身体`);
97 | if (keyword == '群聊') {
98 | r18 = 1;
99 | } else if (keyword == '私聊') {
100 | r18Master = 1;
101 | }
102 | }
103 | if (e.msg.includes('#关闭18')) {
104 | let keyword = e.msg.replace('#关闭18', '');
105 | if (keyword.length == 0) {
106 | e.reply(`请在后面跟进群聊,还是私聊\n我看你是在为难我小派蒙`);
107 | return;
108 | }
109 |
110 | e.reply(`${keyword}已关闭R18模式,进入养生模式`);
111 | if (keyword == '群聊') {
112 | r18 = 0;
113 | } else if (keyword == '私聊') {
114 | r18Master = 0;
115 | }
116 | }
117 | } else {
118 | e.reply('主人才可以进行设置');
119 | }
120 | }
121 | }
122 |
123 | async function sendPixivImg(e) {
124 | msgRes = [];
125 | let keyword;
126 |
127 | if (e.msg == '随机') {
128 | keyword = '';
129 | } else {
130 | keyword = e.msg;
131 | }
132 |
133 | if (e.isGroup) {
134 | url = `https://api.lolicon.app/setu/v2?tag=${keyword}&proxy=i.pixiv.re&r18=${r18}&size=original`;
135 | } else {
136 | url = `https://api.lolicon.app/setu/v2?tag=${keyword}&proxy=i.pixiv.re&r18=${r18Master}&size=original`;
137 | }
138 |
139 | let response = ''; //调用接口获取数据
140 | let res = ''; //结果json字符串转对象
141 |
142 | try {
143 | for (let i = 0; i < sl; i++) {
144 | response = await fetch(url);
145 | res = await response.json();
146 | if (isSendImgFlag == 0) {
147 | let sendText = `标题:${res.data[0].title}\n作者:${res.data[0].author}\n作品id:${res.data[0].pid}\n原网站:https://www.pixiv.net/artworks/${res.data[0].pid}\n可访问网站:${res.data[0].urls.original}`;
148 | msgRes[i] = [sendText];
149 | } else {
150 | msgRes[i] = [segment.image(res.data[0].urls.original)];
151 | }
152 | }
153 | } catch {
154 | e.reply('对不起,没有搜索到' + keyword);
155 | return;
156 | }
157 |
158 | if (res.data.length == 0) {
159 | e.reply('暂时没有搜到哦!换个关键词试试吧!');
160 | return;
161 | }
162 |
163 | console.log('请求url:', msgRes);
164 |
165 | if (e.isGroup) {
166 | let msg = await e.reply(await common.makeForwardMsg(e, msgRes, ''), false, { recallMsg: delMsg });
167 | if (msg == undefined) {
168 | e.reply('请求色图失败,请稍后重试', false, { recallMsg: delMsg });
169 | }
170 | if (delMsgIdList.length > 0) {
171 | setTimeout(() => {
172 | for (let index in delMsgIdList) {
173 | e.group.recallMsg(delMsgIdList[index]);
174 | }
175 | }, delMsg * 1000);
176 | }
177 | } else {
178 | for (let i in msgRes) {
179 | e.reply(msgRes[i], false, { recallMsg: delMsg });
180 | }
181 | }
182 | }
183 |
--------------------------------------------------------------------------------