Type-c commited on
Commit
4eaa1cb
·
verified ·
1 Parent(s): af14d5b

Delete Yunzai/plugins/example/进群退群通知.js

Browse files
Yunzai/plugins/example/进群退群通知.js DELETED
@@ -1,61 +0,0 @@
1
- export class newcomer extends plugin {
2
- constructor() {
3
- super({
4
- name: "欢迎新人",
5
- dsc: "新人入群欢迎",
6
- event: "notice.group.increase",
7
- })
8
- }
9
-
10
- /** 接受到消息都会执行一次 */
11
- async accept() {
12
- if (this.e.user_id == this.e.self_id) return
13
-
14
- /** 定义入群欢迎内容 */
15
- let msg = "欢迎新人!"
16
- /** 冷却cd 30s */
17
- let cd = 30
18
-
19
- /** cd */
20
- let key = `Yz:newcomers:${this.e.group_id}`
21
- if (await redis.get(key)) return
22
- redis.set(key, "1", { EX: cd })
23
-
24
- /** 回复 */
25
- await this.reply([
26
- segment.at(this.e.user_id),
27
- // segment.image(),
28
- msg
29
- ])
30
- }
31
- }
32
-
33
- export class outNotice extends plugin {
34
- constructor() {
35
- super({
36
- name: "退群通知",
37
- dsc: "xx退群了",
38
- event: "notice.group.decrease"
39
- })
40
-
41
- /** 退群提示词 */
42
- this.tips = "退群了"
43
- }
44
-
45
- async accept() {
46
- if (this.e.user_id == this.e.self_id) return
47
-
48
- let name, msg
49
- if (this.e.member) {
50
- name = this.e.member.card || this.e.member.nickname
51
- }
52
-
53
- if (name) {
54
- msg = `${name}(${this.e.user_id}) ${this.tips}`
55
- } else {
56
- msg = `${this.e.user_id} ${this.tips}`
57
- }
58
- logger.mark(`[退出通知]${this.e.logText} ${msg}`)
59
- await this.reply(msg)
60
- }
61
- }