@@ -95,13 +95,11 @@ func init() { // 插件主体
95
95
// 升为管理
96
96
engine .OnRegex (`^升为管理.*?(\d+)` , zero .OnlyGroup , zero .SuperUserPermission ).SetBlock (true ).
97
97
Handle (func (ctx * zero.Ctx ) {
98
- ctx .SetGroupAdmin (
99
- ctx .Event .GroupID ,
98
+ ctx .SetThisGroupAdmin (
100
99
math .Str2Int64 (ctx .State ["regex_matched" ].([]string )[1 ]), // 被升为管理的人的qq
101
100
true ,
102
101
)
103
- nickname := ctx .GetGroupMemberInfo ( // 被升为管理的人的昵称
104
- ctx .Event .GroupID ,
102
+ nickname := ctx .GetThisGroupMemberInfo ( // 被升为管理的人的昵称
105
103
math .Str2Int64 (ctx .State ["regex_matched" ].([]string )[1 ]), // 被升为管理的人的qq
106
104
false ,
107
105
).Get ("nickname" ).Str
@@ -110,13 +108,11 @@ func init() { // 插件主体
110
108
// 取消管理
111
109
engine .OnRegex (`^取消管理.*?(\d+)` , zero .OnlyGroup , zero .SuperUserPermission ).SetBlock (true ).
112
110
Handle (func (ctx * zero.Ctx ) {
113
- ctx .SetGroupAdmin (
114
- ctx .Event .GroupID ,
111
+ ctx .SetThisGroupAdmin (
115
112
math .Str2Int64 (ctx .State ["regex_matched" ].([]string )[1 ]), // 被取消管理的人的qq
116
113
false ,
117
114
)
118
- nickname := ctx .GetGroupMemberInfo ( // 被取消管理的人的昵称
119
- ctx .Event .GroupID ,
115
+ nickname := ctx .GetThisGroupMemberInfo ( // 被取消管理的人的昵称
120
116
math .Str2Int64 (ctx .State ["regex_matched" ].([]string )[1 ]), // 被取消管理的人的qq
121
117
false ,
122
118
).Get ("nickname" ).Str
@@ -125,13 +121,11 @@ func init() { // 插件主体
125
121
// 踢出群聊
126
122
engine .OnRegex (`^踢出群聊.*?(\d+)` , zero .OnlyGroup , zero .AdminPermission ).SetBlock (true ).
127
123
Handle (func (ctx * zero.Ctx ) {
128
- ctx .SetGroupKick (
129
- ctx .Event .GroupID ,
124
+ ctx .SetThisGroupKick (
130
125
math .Str2Int64 (ctx .State ["regex_matched" ].([]string )[1 ]), // 被踢出群聊的人的qq
131
126
false ,
132
127
)
133
- nickname := ctx .GetGroupMemberInfo ( // 被踢出群聊的人的昵称
134
- ctx .Event .GroupID ,
128
+ nickname := ctx .GetThisGroupMemberInfo ( // 被踢出群聊的人的昵称
135
129
math .Str2Int64 (ctx .State ["regex_matched" ].([]string )[1 ]), // 被踢出群聊的人的qq
136
130
false ,
137
131
).Get ("nickname" ).Str
@@ -148,19 +142,13 @@ func init() { // 插件主体
148
142
// 开启全体禁言
149
143
engine .OnRegex (`^开启全员禁言$` , zero .OnlyGroup , zero .AdminPermission ).SetBlock (true ).
150
144
Handle (func (ctx * zero.Ctx ) {
151
- ctx .SetGroupWholeBan (
152
- ctx .Event .GroupID ,
153
- true ,
154
- )
145
+ ctx .SetThisGroupWholeBan (true )
155
146
ctx .SendChain (message .Text ("全员自闭开始~" ))
156
147
})
157
148
// 解除全员禁言
158
149
engine .OnRegex (`^解除全员禁言$` , zero .OnlyGroup , zero .AdminPermission ).SetBlock (true ).
159
150
Handle (func (ctx * zero.Ctx ) {
160
- ctx .SetGroupWholeBan (
161
- ctx .Event .GroupID ,
162
- false ,
163
- )
151
+ ctx .SetThisGroupWholeBan (false )
164
152
ctx .SendChain (message .Text ("全员自闭结束~" ))
165
153
})
166
154
// 禁言
@@ -180,8 +168,7 @@ func init() { // 插件主体
180
168
if duration >= 43200 {
181
169
duration = 43199 // qq禁言最大时长为一个月
182
170
}
183
- ctx .SetGroupBan (
184
- ctx .Event .GroupID ,
171
+ ctx .SetThisGroupBan (
185
172
math .Str2Int64 (ctx .State ["regex_matched" ].([]string )[1 ]), // 要禁言的人的qq
186
173
duration * 60 , // 要禁言的时间(分钟)
187
174
)
@@ -190,8 +177,7 @@ func init() { // 插件主体
190
177
// 解除禁言
191
178
engine .OnRegex (`^解除禁言.*?(\d+)` , zero .OnlyGroup , zero .AdminPermission ).SetBlock (true ).
192
179
Handle (func (ctx * zero.Ctx ) {
193
- ctx .SetGroupBan (
194
- ctx .Event .GroupID ,
180
+ ctx .SetThisGroupBan (
195
181
math .Str2Int64 (ctx .State ["regex_matched" ].([]string )[1 ]), // 要解除禁言的人的qq
196
182
0 ,
197
183
)
@@ -214,8 +200,7 @@ func init() { // 插件主体
214
200
if duration >= 43200 {
215
201
duration = 43199 // qq禁言最大时长为一个月
216
202
}
217
- ctx .SetGroupBan (
218
- ctx .Event .GroupID ,
203
+ ctx .SetThisGroupBan (
219
204
ctx .Event .UserID ,
220
205
duration * 60 , // 要自闭的时间(分钟)
221
206
)
@@ -228,8 +213,7 @@ func init() { // 插件主体
228
213
ctx .SendChain (message .Text ("名字太长啦!" ))
229
214
return
230
215
}
231
- ctx .SetGroupCard (
232
- ctx .Event .GroupID ,
216
+ ctx .SetThisGroupCard (
233
217
math .Str2Int64 (ctx .State ["regex_matched" ].([]string )[1 ]), // 被修改群名片的人
234
218
ctx .State ["regex_matched" ].([]string )[2 ], // 修改成的群名片
235
219
)
@@ -246,8 +230,7 @@ func init() { // 插件主体
246
230
ctx .SendChain (message .Text ("头衔太长啦!" ))
247
231
return
248
232
}
249
- ctx .SetGroupSpecialTitle (
250
- ctx .Event .GroupID ,
233
+ ctx .SetThisGroupSpecialTitle (
251
234
math .Str2Int64 (ctx .State ["regex_matched" ].([]string )[1 ]), // 被修改群头衔的人
252
235
sptitle , // 修改成的群头衔
253
236
)
@@ -264,8 +247,7 @@ func init() { // 插件主体
264
247
ctx .SendChain (message .Text ("头衔太长啦!" ))
265
248
return
266
249
}
267
- ctx .SetGroupSpecialTitle (
268
- ctx .Event .GroupID ,
250
+ ctx .SetThisGroupSpecialTitle (
269
251
ctx .Event .UserID , // 被修改群头衔的人
270
252
sptitle , // 修改成的群头衔
271
253
)
@@ -445,7 +427,7 @@ func init() { // 插件主体
445
427
case <- time .After (time .Minute ):
446
428
cancel ()
447
429
ctx .SendChain (message .Text ("拜拜啦~" ))
448
- ctx .SetGroupKick ( ctx . Event . GroupID , uid , false )
430
+ ctx .SetThisGroupKick ( uid , false )
449
431
case <- recv :
450
432
cancel ()
451
433
ctx .SendChain (message .Text ("答对啦~" ))
@@ -594,7 +576,7 @@ func init() { // 插件主体
594
576
if ok {
595
577
ctx .SetGroupAddRequest (ctx .Event .Flag , "add" , true , "" )
596
578
process .SleepAbout1sTo2s ()
597
- ctx .SetGroupCard ( ctx . Event . GroupID , ctx .Event .UserID , ghun )
579
+ ctx .SetThisGroupCard ( ctx .Event .UserID , ghun )
598
580
} else {
599
581
ctx .SetGroupAddRequest (ctx .Event .Flag , "add" , false , reason )
600
582
}
@@ -618,7 +600,7 @@ func init() { // 插件主体
618
600
}
619
601
})
620
602
engine .OnCommand ("精华列表" , zero .OnlyGroup , zero .AdminPermission ).SetBlock (true ).Limit (ctxext .LimitByUser ).Handle (func (ctx * zero.Ctx ) {
621
- list := ctx .GetGroupEssenceMessageList ( ctx . Event . GroupID ).Array ()
603
+ list := ctx .GetThisGroupEssenceMessageList ( ).Array ()
622
604
msg := message.Message {ctxext .FakeSenderForwardNode (ctx , message .Text ("本群精华列表:" ))}
623
605
n := len (list )
624
606
if n > 30 {
@@ -675,7 +657,7 @@ func welcometocq(ctx *zero.Ctx, welcome string) string {
675
657
at := "[CQ:at,qq=" + uid + "]" // at用户
676
658
avatar := "[CQ:image,file=" + "http://q4.qlogo.cn/g?b=qq&nk=" + uid + "&s=640]" // 用户头像
677
659
gid := strconv .FormatInt (ctx .Event .GroupID , 10 ) // 群id
678
- groupname := ctx .GetGroupInfo ( ctx . Event . GroupID , true ).Name // 群名
660
+ groupname := ctx .GetThisGroupInfo ( true ).Name // 群名
679
661
cqstring := strings .ReplaceAll (welcome , "{at}" , at )
680
662
cqstring = strings .ReplaceAll (cqstring , "{nickname}" , nickname )
681
663
cqstring = strings .ReplaceAll (cqstring , "{avatar}" , avatar )
0 commit comments