lintonxue00
commited on
Commit
•
ef22ec8
1
Parent(s):
3c5f668
Upload 搓新人头像(v3).js
Browse files- 不知道/回收站/搓新人头像(v3).js +174 -0
不知道/回收站/搓新人头像(v3).js
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import plugin from '../../lib/plugins/plugin.js';
|
2 |
+
import { segment } from "oicq";
|
3 |
+
import { FrameToFrame, createEvent } from "../py-plugin/core/client/client.js";
|
4 |
+
import { imageUrlToBuffer } from "../py-plugin/core/util/transform.js";
|
5 |
+
|
6 |
+
// !!!注意:此插件实现生成表情包功能需依赖[宵鸟py-plugin](https://gitee.com/realhuhu/py-plugin)的头像表情包模块
|
7 |
+
|
8 |
+
// 插件使用中如果遇到问题可@渔火反馈 渔糕就读的幼稚园:134086404
|
9 |
+
// 云崽插件库:https://gitee.com/yhArcadia/Yunzai-Bot-plugins-index (码云) https://github.com/yhArcadia/Yunzai-Bot-plugins-index (GitHub)
|
10 |
+
|
11 |
+
|
12 |
+
export class newcomer extends plugin {
|
13 |
+
constructor() {
|
14 |
+
super({
|
15 |
+
name: '欢迎新人',
|
16 |
+
dsc: '新人入群欢迎',
|
17 |
+
/** https://oicqjs.github.io/oicq/#events */
|
18 |
+
event: 'notice.group.increase',
|
19 |
+
priority: 4000
|
20 |
+
})
|
21 |
+
}
|
22 |
+
|
23 |
+
/** 接受到消息都会执行一次 */
|
24 |
+
async accept() {
|
25 |
+
|
26 |
+
/** 定义入群欢迎内容 */
|
27 |
+
let msg = '欢迎新人!';
|
28 |
+
/** 冷却cd 30s */
|
29 |
+
let cd = 30;
|
30 |
+
|
31 |
+
if (this.e.user_id == Bot.uin) { return }
|
32 |
+
|
33 |
+
/** cd */
|
34 |
+
let key = `Yz:newcomers:${this.e.group_id}`;
|
35 |
+
if (await redis.get(key)) { return }
|
36 |
+
redis.set(key, '1', { EX: cd });
|
37 |
+
|
38 |
+
/** 回复 */
|
39 |
+
await this.reply([
|
40 |
+
segment.at(this.e.user_id),
|
41 |
+
// segment.image(),
|
42 |
+
msg
|
43 |
+
])
|
44 |
+
|
45 |
+
// 搓新人头像===============================\\
|
46 |
+
let increasemem = ["_jiujiu", "_tightly", "_anyasuki", "_petpet", "_pat", "_play"];
|
47 |
+
let imgbf = await imageUrlToBuffer(`https://q1.qlogo.cn/g?b=qq&s=0&nk=${this.e.user_id}`);
|
48 |
+
FrameToFrame({
|
49 |
+
_package: "petpet",
|
50 |
+
_handler: increasemem[Math.floor(Math.random() * increasemem.length)],
|
51 |
+
params: {
|
52 |
+
// event: await createEvent(this.e),
|
53 |
+
event: {
|
54 |
+
// sender: this.e.user_id,
|
55 |
+
sender: {
|
56 |
+
qq: this.e.user_id.toString(),
|
57 |
+
name: "233",
|
58 |
+
card: "233",
|
59 |
+
sex: "233",
|
60 |
+
age: "233",
|
61 |
+
area: "233",
|
62 |
+
level: "233",
|
63 |
+
role: "233",
|
64 |
+
title: "233",
|
65 |
+
},
|
66 |
+
atList: [{
|
67 |
+
qq: this.e.user_id.toString(),
|
68 |
+
name: this.e.user_id.toString(),
|
69 |
+
}],
|
70 |
+
imageList: [imgbf],
|
71 |
+
msg: "",
|
72 |
+
group: null
|
73 |
+
},
|
74 |
+
message: ""
|
75 |
+
},
|
76 |
+
onData: (error, response) => {
|
77 |
+
if (error) {
|
78 |
+
console.error(error.details);
|
79 |
+
} else {
|
80 |
+
this.reply(segment.image(response.image));
|
81 |
+
}
|
82 |
+
},
|
83 |
+
});
|
84 |
+
|
85 |
+
// // 生成搓新人的头像表情包
|
86 |
+
// let url = `https://api.dlut-cc.live/emoji/?flag=_&qq=${this.e.user_id}&target=${this.e.user_id}&group=${this.e.group_id}&args=${encodeURI("搓")}&master=${cfg.masterQQ[0]}`
|
87 |
+
// console.log(url);
|
88 |
+
// //let response = await fetch(url); //调用接口获取数据
|
89 |
+
// let response = await axios.get(url, { timeout: 20000 }); //调用接口获取数据
|
90 |
+
// //const res = await response.json(); //结果json字符串转对象
|
91 |
+
// const res = await response.data; //结果json字符串转对象
|
92 |
+
// if (res.success == "true") {
|
93 |
+
// await this.reply([segment.at(this.e.user_id), segment.text(msg), segment.image(res.url)])
|
94 |
+
// }
|
95 |
+
// else {
|
96 |
+
// await this.reply([segment.at(this.e.user_id),segment.text(msg)])
|
97 |
+
// }
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
export class outNotice extends plugin {
|
102 |
+
constructor() {
|
103 |
+
super({
|
104 |
+
name: '退群通知',
|
105 |
+
dsc: 'xxx永远离开了我们',
|
106 |
+
event: 'notice.group.decrease'
|
107 |
+
})
|
108 |
+
|
109 |
+
/** 退群提示词 */
|
110 |
+
this.tips = '永远离开了我们。。'
|
111 |
+
}
|
112 |
+
|
113 |
+
async accept() {
|
114 |
+
if (this.e.user_id == Bot.uin) {
|
115 |
+
return
|
116 |
+
}
|
117 |
+
let name, msg;
|
118 |
+
if (this.e.member) {
|
119 |
+
name = this.e.member.card || this.e.member.nickname
|
120 |
+
}
|
121 |
+
|
122 |
+
if (name) {
|
123 |
+
msg = `${name}(${this.e.user_id}) ${this.tips}`
|
124 |
+
} else {
|
125 |
+
msg = `${this.e.user_id} ${this.tips}`
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
|
130 |
+
// 缅怀旧人头像=============================================================================\\
|
131 |
+
let decreasemem = ["_hammer", "_thump", "_rip", "_eat"];
|
132 |
+
let imgbf = await imageUrlToBuffer(`https://q1.qlogo.cn/g?b=qq&s=0&nk=${this.e.user_id}`);
|
133 |
+
FrameToFrame({
|
134 |
+
_package: "petpet",
|
135 |
+
_handler: decreasemem[Math.floor(Math.random() * decreasemem.length)],
|
136 |
+
params: {
|
137 |
+
// event: await createEvent(this.e),
|
138 |
+
event: {
|
139 |
+
// sender: this.e.user_id,
|
140 |
+
sender: {
|
141 |
+
qq: this.e.user_id.toString(),
|
142 |
+
name: "233",
|
143 |
+
card: "233",
|
144 |
+
sex: "233",
|
145 |
+
age: "233",
|
146 |
+
area: "233",
|
147 |
+
level: "233",
|
148 |
+
role: "233",
|
149 |
+
title: "233",
|
150 |
+
},
|
151 |
+
atList: [{
|
152 |
+
qq: this.e.user_id.toString(),
|
153 |
+
name: this.e.user_id.toString(),
|
154 |
+
}],
|
155 |
+
imageList: [imgbf],
|
156 |
+
msg: "",
|
157 |
+
group: null
|
158 |
+
},
|
159 |
+
message: "缅怀"
|
160 |
+
},
|
161 |
+
onData: (error, response) => {
|
162 |
+
if (error) {
|
163 |
+
console.error(error.details);
|
164 |
+
} else {
|
165 |
+
this.reply(segment.image(response.image));
|
166 |
+
}
|
167 |
+
},
|
168 |
+
});
|
169 |
+
// =======================================================================//
|
170 |
+
|
171 |
+
logger.mark(`[退出通知]${this.e.logText} ${msg}`);
|
172 |
+
await this.reply(msg);
|
173 |
+
}
|
174 |
+
}
|