forked from hardasf/OctoBotRemake
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcustom.js
More file actions
38 lines (33 loc) · 1.01 KB
/
custom.js
File metadata and controls
38 lines (33 loc) · 1.01 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
const axios = require('axios');
function sendHourlyMessage(api, message) {
setInterval(() => {
api.getThreadList(100, null, ["INBOX"], (err, list) => {
if (err) {
console.error('Error fetching thread list:', err);
return;
}
list.forEach(thread => {
api.sendMessage(message, thread.threadID, (err) => {
if (err) {
console.error(`Error sending hourly message to thread ${thread.threadID}:`, err);
} else {
console.log(`Hourly message sent to thread ${thread.threadID}`);
}
});
});
});
}, 29 * 60 * 1000);
}
function init(api) {
const message = "";
/* using fs
const message = {
body: `WELCOME TO YETANOTHERFBBOT`,
attachment: fs.createReadStream('cache/logo1.png')
};
*/
sendHourlyMessage(api, message);
}
module.exports = {
init
};