-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcombise.js
More file actions
62 lines (46 loc) · 1.05 KB
/
combise.js
File metadata and controls
62 lines (46 loc) · 1.05 KB
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
const { VK, Keyboard } = require('vk-io');
const vk = new VK();
const { updates } = vk;
const { groupID, token } = require('./.token.js');
module.exports = xbot = {
name: "Combine Speech",
start: tryStart
};
function tryStart() {
start(arguments)
}
function start() {
_.con(xbot.name+" start");
run().catch(console.error);
}
vk.setOptions({
token,
pollingGroupId: groupID,
apiMode: 'parallel_selected',
});
// Skip outbox message and handle errors
updates.use(async (context, next) => {
if (context.is('message') && context.isOutbox) {
return;
}
try {
await next();
} catch (error) {
console.error('Error:', error);
}
});
// Set online status
setInterval(async ()=> {
try {
const { status } = await vk.api.groups.getOnlineStatus({ group_id: groupID });
if(status == "none")
await vk.api.groups.enableOnline({ group_id: groupID });
} catch(e) { }
}, 6e4);
const q = require("./qore");
module.exports.q = q;
q(vk, Keyboard, xbot.name);
async function run() {
await vk.updates.startPolling();
_.con('Polling started', "cyan");
}