|
@@ -30,28 +30,47 @@ db.defaults({
|
|
|
"485109695846023209"
|
|
|
]
|
|
|
},
|
|
|
- specialUsers: ["141880968800763905", "307897683849510912", "335898304472678402"],
|
|
|
+ specialUsers: [
|
|
|
+ "141880968800763905",
|
|
|
+ "307897683849510912",
|
|
|
+ "335898304472678402"
|
|
|
+ ],
|
|
|
+ reactableMentionedUsers: ["307897683849510912", "335898304472678402"],
|
|
|
guides: {},
|
|
|
editors: {
|
|
|
roles: ["484046157971193866", "305844721622712322"],
|
|
|
- users: ["307897683849510912", "170116346095468545", "335898304472678402"]
|
|
|
+ users: [
|
|
|
+ "307897683849510912",
|
|
|
+ "170116346095468545",
|
|
|
+ "335898304472678402"
|
|
|
+ ]
|
|
|
}
|
|
|
}).write();
|
|
|
|
|
|
const client = new Discord.Client();
|
|
|
|
|
|
function isAuthorised(member) {
|
|
|
- if(db.get("editors.users").includes(member.id).value())
|
|
|
+ if (
|
|
|
+ db
|
|
|
+ .get("editors.users")
|
|
|
+ .includes(member.id)
|
|
|
+ .value()
|
|
|
+ )
|
|
|
return true;
|
|
|
- if(db.get("editors.roles").intersectionWith(member.roles.keyArray()).isEmpty().value())
|
|
|
+ if (
|
|
|
+ db
|
|
|
+ .get("editors.roles")
|
|
|
+ .intersectionWith(member.roles.keyArray())
|
|
|
+ .isEmpty()
|
|
|
+ .value()
|
|
|
+ )
|
|
|
return false;
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
const commands = {
|
|
|
"make guide": (msg, s) => {
|
|
|
- if(!isAuthorised(msg.member))
|
|
|
- return;
|
|
|
+ if (!isAuthorised(msg.member)) return;
|
|
|
let content = s.substring("make guide ".length);
|
|
|
let guideName = content.substring(0, content.indexOf("\n")).trim();
|
|
|
let guideContent = content.substring(content.indexOf("\n")).trim();
|
|
@@ -63,8 +82,7 @@ const commands = {
|
|
|
);
|
|
|
},
|
|
|
"delete guide": (msg, s) => {
|
|
|
- if(!isAuthorised(msg.member))
|
|
|
- return;
|
|
|
+ if (!isAuthorised(msg.member)) return;
|
|
|
let guideName = s.substring("delete guide ".length).trim();
|
|
|
if (
|
|
|
!db
|
|
@@ -98,11 +116,28 @@ const commands = {
|
|
|
|
|
|
client.on("ready", () => {
|
|
|
console.log("Ready!");
|
|
|
- client.user.setActivity("@NoctBot help");
|
|
|
+ client.user.setActivity("@NoctBot help", { type: "PLAYING" });
|
|
|
});
|
|
|
|
|
|
client.on("message", m => {
|
|
|
- if (m.mentions.users.size == 0) return;
|
|
|
+ if (m.author.id == client.user.id || m.mentions.users.size == 0) return;
|
|
|
+
|
|
|
+ if (
|
|
|
+ !db
|
|
|
+ .get("reactableMentionedUsers")
|
|
|
+ .intersectionWith(m.mentions.users.map(u => u.id))
|
|
|
+ .isEmpty()
|
|
|
+ .value()
|
|
|
+ ) {
|
|
|
+ const emoteId = db
|
|
|
+ .get("emotes")
|
|
|
+ .get("angery")
|
|
|
+ .randomElement()
|
|
|
+ .value();
|
|
|
+ m.react(client.emojis.find(e => e.id == emoteId));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (m.mentions.users.first().id == client.user.id) {
|
|
|
let content = m.cleanContent.substring(
|
|
|
`@${client.user.username} `.length
|