This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot_admins.js
106 lines (89 loc) · 3.39 KB
/
bot_admins.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/// This file is dedicated to the management and improvement of the bot
///
// list of people who are trustworthy of not breaking my server
const botAdmins = [ "253784341555970048", // @ridderhoff#6333
"186157998538883092", // @fsm#
];
// export list
module.exports.list = botAdmins;
// is given user trustworthy
module.exports.auth = id => botAdmins.includes(id);
const root = [ "253784341555970048" ]; // @ridderhoff
// feel free to join the server btw: https://discord.gg/cXcXSmy
const bugReportChannel = "455415485173858318";
module.exports.bugReportChannel = bugReportChannel; // atest server:botstuff#bugs
module.exports.sendBugReport = async (msg, bug) => {
if (msg)
(await global.client.channels.fetch(bugReportChannel))
.send(`@${msg.author.username}#${msg.author.discriminator} found a bug(${msg.content}): ${bug}`);
else
(await global.client.channels.fetch(bugReportChannel))
.send(`untraced error: ${bug}`);
}
module.exports.bug = bug => module.exports.sendBugReport(null, bug);
module.exports.joinGuild = async g => {
if (g.owner) g.owner.createDM().then(dm => dm.send(`Hey, you just added me to ${g.name}. :D
- To set up your server, add features, change behavior, etc. goto https://corki.js.org/portal?rdr=mod
- To allow admins/mods to do it for you goto https://corki.js.org/portal?rdr=admin
- For some general info on the bot go to https://corki.js.org`)).catch(console.error);
console.log(`Guild joined: ${g.name}#${g.id}`);
(await global.client.channels.fetch("566432610532982804")).send({ embed: {
title: "Added to Guild",
description: `${global.client.user} was added to ${g.name}#${g.id} :D`,
fields: [
{
name: "Servers",
value: global.client.guilds.cache.size,
inline: true,
}, {
name: "Users Gained",
value: g.memberCount,
inline: true,
}, {
name: "Total Users",
value: usersCount(),
inline: true,
}
]
}});
};
module.exports.leaveGuild = async g => {
try {
console.log(`Guild deleted/left: ${g.name}#${g.id}`, g);
if (!g.name) {
console.log(g);
return;
}
if (g.owner) g.owner.createDM().then(dm => dm.send(`
I'm not sure what happened to ${g.name}. If the server was deleted you can \
disregard this message. If you no longer need corki bot in your server \
that's fine too. If you could please send a \`-bug\` report (or contact @ridderhoff#6333) giving some \
pointers on any ideas on how to improve the bot, that would be amazing!`))
.catch(console.error);
(await global.client.channels.fetch("566432610532982804")).send({ embed: {
title: "Removed from giuld",
description: `${global.client.user} was removed from ${g.name}#${g.id} :(`,
fields: [
{
name: "Servers",
value: global.client.guilds.cache.size,
inline: true,
}, {
name: "Users Lost",
value: g.memberCount,
inline: true,
}, {
name: "Total Users",
value: usersCount(),
inline: true,
}
],
}});
} catch(e) {console.error(e);}
}
function usersCount() {
return global.client.guilds.cache.array()
.map(g => g.memberCount)
.reduce((accum, v) => accum + v);
}
module.exports.usersCount = usersCount;