-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (23 loc) · 910 Bytes
/
index.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
import VK from './src/VK.js'
let Config = {
ACCESS_TOKEN: ' < your token > '
}
let vk = new VK(Config.ACCESS_TOKEN);
let CheckFriends = async () => {
try {
let { count, items } = (await vk.call('friends.get')).response;
if (Config.cache && Config.cache.count > count) {
let Deleted = Config.cache.items.filter(item => !items.includes(item));
Deleted = (await vk.call('users.get', { user_ids: Deleted.join(', ') })).response;
vk.call('messages.send', {
peer_id: vk.user_id,
message: `Пользователи удалены из друзей:\n` + Deleted.map(usr => `@id${usr.id} (${usr.first_name} ${usr.last_name})`).join('\n')
})
}
Config.cache = { count, items };
} catch(e) {
console.error(e);
}
}
CheckFriends();
setInterval(CheckFriends, 30 * 60 * 1000);