-
Notifications
You must be signed in to change notification settings - Fork 13
/
plugin.chinanet.js
38 lines (31 loc) · 931 Bytes
/
plugin.chinanet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
const config = require('./config');
module.exports = (bot, event, playerEvent, env) => {
bot.onText(/^\/listre(@\w+)?$/, event((msg, match) => {
let text = '';
for (const i in config.chinanetCommandMap) {
text += config.chinanetCommandMap[i] + ' -> ' + i + '\n';
}
bot.sendMessage(
msg.chat.id,
text,
{
reply_to_message_id: msg.message_id,
}
);
}, 1));
const genEvent = (key) => {
return (msg, match) => {
if (!config.threesomeSilent[msg.chat.id]) {
env.command.get(msg, key, []);
}
};
};
for (const i in config.chinanetCommandMap) {
bot.onText(config.chinanetCommandMap[i], event(genEvent(i), -1));
}
env.info.addPluginHelp(
'chinanet',
'/listre 列出正则 trigger 内容'
);
};