-
Notifications
You must be signed in to change notification settings - Fork 1
/
backup.js
49 lines (43 loc) · 1.24 KB
/
backup.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
const backupServer = []
const bot = '964504741222678579'
exports.backupAll = async function (obj) {
try {
type = obj['type']
if (type == "channel_create") {
await obj['channel'].delete().catch(err => console.log('err'))
obj['status'] = true
}
if (type == "channel_delete") {
await obj['channel'].clone().catch(err => console.log('err'))
obj['status'] = true
}
if (type == "role_create") {
await obj['role'].delete().catch(err => console.log('err'))
obj['status'] = true
}
if (type == "role_delete") {
await obj['role'].guild.roles.create({
data: {
name: obj['role'].name,
color: 'BLUE',
},
reason: 'Восстановление сервера',
})
.then(console.log)
.catch(console.error);
obj['status'] = true
}
if (type == "role_update") {
await obj['newRole'].setPermissions(rl['changes']['old'])
obj['status'] = true
}
if (type == "webhook_create") {
await obj['webhook'].delete().catch(err => console.log('err'))
obj['status'] = true
}
} catch {
console.log('err')
}
}
exports.backupServer = backupServer
exports.botId = bot