forked from hczhcz/telegram-kuso-bots
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.tgf.js
More file actions
35 lines (29 loc) · 729 Bytes
/
bot.tgf.js
File metadata and controls
35 lines (29 loc) · 729 Bytes
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
'use strict';
const Tgfancy = require('tgfancy');
process.on('uncaughtException', (err) => {
console.error(Date());
console.error(err);
});
module.exports = (token) => {
const bot = new Tgfancy(token, {
polling: {
interval: 1000,
},
options: {
orderedSending: false,
},
});
bot.on('error', (err) => {
if (!(err instanceof Tgfancy.errors.ParseError)) {
console.error(Date());
console.error(err);
}
});
bot.on('polling_error', (err) => {
if (!(err instanceof Tgfancy.errors.ParseError)) {
console.error(Date());
console.error(err);
}
});
return bot;
};