-
Notifications
You must be signed in to change notification settings - Fork 13
/
plugin.123.js
62 lines (48 loc) · 1.36 KB
/
plugin.123.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
'use strict';
const fs = require('fs');
const config = require('./config');
module.exports = (bot, event, playerEvent, env) => {
const fd = fs.openSync('log.123', 'a');
const actions = {};
bot.on('message', (msg) => {
if (config.ban[msg.from.id] || !actions[msg.chat.id]) {
return;
}
const action = actions[msg.chat.id];
delete actions[msg.chat.id];
fs.write(fd, JSON.stringify({
msg: msg,
action: action,
}) + '\n', () => {
// nothing
});
bot.sendMessage(
msg.chat.id,
action,
{
reply_to_message_id: msg.message_id,
}
);
});
bot.onText(/123(.*人)/, event((msg, match) => {
actions[msg.chat.id] = '你是假的' + match[1] + '!';
fs.write(fd, JSON.stringify({
msg: msg,
}) + '\n', () => {
// nothing
});
}, -1));
bot.onText(/123不许(.+)/, event((msg, match) => {
actions[msg.chat.id] = '你' + match[1] + '了!';
fs.write(fd, JSON.stringify({
msg: msg,
}) + '\n', () => {
// nothing
});
}, -1));
env.info.addPluginHelp(
'123',
'123<...>人 触发木头人事件\n'
+ '123不许<...> 触发不许动事件'
);
};