2
2
* 小冰
3
3
*
4
4
* command: '!bing'
5
- * types: {
6
- * 'qq/123456': 'xiaoice' / 'babyq'
7
- * }
5
+ * types: [
6
+ * 'qq/123456'
7
+ * ]
8
8
*/
9
9
10
10
'use strict' ;
@@ -18,36 +18,24 @@ module.exports = (pluginManager, options) => {
18
18
return ;
19
19
}
20
20
21
- if ( ! options . disallowedClients ) {
22
- options . disallowedClients = [ 'QQ' ] ;
23
- } else {
24
- options . disallowedClients . push ( 'QQ' ) ;
25
- }
26
-
27
21
let qqHandler = pluginManager . handlers . get ( 'QQ' ) ;
28
22
let command = options . command || '!bing' ;
29
- let types = { } ;
23
+ let types = [ ] ;
30
24
31
- for ( let t in ( options . types || { } ) ) {
25
+ for ( let t of ( options . types || [ ] ) ) {
32
26
let client = BridgeMsg . parseUID ( t ) ;
33
27
if ( client . uid ) {
34
- types [ client . uid ] = options . types [ t ] . toLowerCase ( ) ;
28
+ types . push ( client . uid ) ;
35
29
}
36
30
}
37
31
38
32
bridge . addCommand ( command , ( context ) => {
39
33
if ( ! context . isPrivate ) {
40
34
for ( let c of context . extra . mapto ) {
41
35
let client = BridgeMsg . parseUID ( c ) ;
42
- let qq = null ;
43
36
if ( client . client === 'QQ' ) {
44
- if ( types [ client . uid ] === 'xiaobing' || types [ client . uid ] === 'xiaoice' ) {
45
- qq = '2854196306' ;
46
- } else if ( types [ client . uid ] === 'babyq' ) {
47
- qq = '2854196300' ;
48
- }
49
- if ( qq ) {
50
- qqHandler . say ( client . id , `[CQ:at,qq=${ qq } ] ${ qqHandler . escape ( context . param ) } ` , {
37
+ if ( types . indexOf ( client . uid ) > - 1 ) {
38
+ qqHandler . say ( client . id , `[CQ:at,qq=2854196306] ${ qqHandler . escape ( context . param ) } ` , {
51
39
noEscape : true ,
52
40
} ) ;
53
41
}
0 commit comments