Skip to content

Commit b16aafa

Browse files
committed
v5 Update 9
Here we go. We're pushing to the final moment. This update includes the following changes below * Added Role Create, Delete, and Update Logging. * Added Channel Create, Delete, and Update Logging. * Footer no longer required in message msgHandler function. You can still add it, but it will automatically add the default footer. * Reaction Roles WOOO; For the first time in TheCodingBot history, there are reaction roles. The system is still probably in alpha stages, so if something breaks, let me know! * Removed Version checking in bootloader. One of the dependencies was having a fit lol. * Oh, in in the logging events, 'channel' is now 'logChannel' to clear up le confusion... thank me later. Enjoy v5 Update 9 ^^
1 parent d8e6c22 commit b16aafa

35 files changed

Lines changed: 935 additions & 184 deletions

src/app/cfg/app.js

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ const app = {
3636
}
3737
},
3838

39+
types: {
40+
channels: {
41+
GUILD_TEXT: "Text Channel",
42+
GUILD_VOICE: "Voice Channel",
43+
GUILD_CATEGORY: "Category",
44+
GUILD_NEWS: "News Channel",
45+
GUILD_STAGE_VOICE: "Stage Channel"
46+
}
47+
},
48+
3949
functions: {
4050
sleep: function(ms) {
4151
return new Promise(resolve => setTimeout(resolve, ms));
@@ -212,16 +222,18 @@ const app = {
212222
title: `${app.config.system.emotes.error} **Missing Permissions**`,
213223
color: app.config.system.embedColors.red,
214224
description: `You're lacking ${lackedPerms} to ${cantdo}.\nSorry about that...`,
215-
footer: { text: app.config.system.footerText }
216225
}]
217226
}, edit, true);
218227
},
219228
msgHandler: async function(message, options, action = 0, doReply = false, callback = null) { // action: 0 = Send, 1 = Edit
220-
if (options["author"] != null) {
221-
var author = options["author"];
222-
if (author.id)
223-
options.embeds[0]["author"] = { name: `Hello, ${author.tag}!`, icon_url: author.displayAvatarURL({ format: 'png', dynamic: true, size: 1024 }) };
224-
delete options["author"];
229+
if (options.embeds) {
230+
if (options["author"] != null) {
231+
var author = options["author"];
232+
if (author.id)
233+
options.embeds[0]["author"] = { name: `Hello, ${author.tag}!`, icon_url: author.displayAvatarURL({ format: 'png', dynamic: true, size: 1024 }) };
234+
delete options["author"];
235+
};
236+
if (!options.embeds[0]["footer"]) options.embeds[0]["footer"] = { text: app.config.system.footerText }; // Install branding.exe
225237
};
226238

227239
if (action == 0) {
@@ -239,8 +251,7 @@ const app = {
239251
app.functions.msgHandler(msg, {
240252
embeds: [{
241253
color: app.config.system.embedColors.red,
242-
description: "Failed to remove all reactions! Will attempt to remove my reactions only...",
243-
footer: { text: app.config.system.footerText }
254+
description: "Failed to remove all reactions! Will attempt to remove my reactions only..."
244255
}]
245256
}, 0, true, (async m => {
246257
var myID = app.client.user.id;
@@ -253,7 +264,6 @@ const app = {
253264
embeds: [{
254265
color: app.config.system.embedColors.red,
255266
description: "Failed to remove my reactions! well, that's an F.",
256-
footer: { text: app.config.system.footerText }
257267
}]
258268
}, 1, true);
259269
app.logger.error("DISCORD", "Could not remove my reactions due to " + err);
@@ -274,12 +284,12 @@ const app = {
274284
description: `Command \`${((command.name) ? command.name : command)}\` was not found!`,
275285
fields: [
276286
{ name: "Lost?", value: `You should check out the \`${userSettings.get("prefix")}help\`` }
277-
],
278-
footer: { text: app.config.system.footerText }
287+
]
279288
}]
280289
}
281290
else {
282291
var msg = ((err.message && err.message != "") ? "js\n" + err.message : (err && err != "") ? err : "Unknown Error.");
292+
283293
data = {
284294
embeds: [{
285295
title: embedTitle,
@@ -288,16 +298,14 @@ const app = {
288298
fields: [
289299
{ name: "Error Details", value: "```" + msg + "```" }
290300

291-
],
292-
footer: { text: app.config.system.footerText }
301+
]
293302
}]
294303
};
295304
if (type == "error" && err.stack) {
296305
var stack = err.stack,
297-
maxLength = 2000,
306+
maxLength = 1020,
298307
msg = "(continued)";
299-
if (stack.length > maxLength) stack = stack.match(new RegExp('.{1,' + (maxLength - msg.length) + '}', 'g'))[0] + msg;
300-
data.embeds[0].fields.push({ name: "Stacktrace", value: "```js\n" + err.stack + "```" });
308+
// data.embeds[0].fields.push({ name: "Stacktrace", value: "```js\n" + err.stack + "```" });
301309
userSettings.update({ executedCommands: (userSettings.get('errorCommands') + 1) }, { where: { userID: message.author.id } });
302310
};
303311
};

src/app/cmds/Fun/8ball.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ module.exports = {
1515
embeds: [{
1616
title: `${app.config.system.emotes.error} Error`,
1717
color: app.config.system.embedColors.red,
18-
description: "You need to ask a question!",
19-
footer: { text: app.config.system.footerText + " | An error occurred." }
18+
description: "You need to ask a question!"
2019
}]
2120
}, 0, true);
2221

@@ -44,8 +43,7 @@ module.exports = {
4443
fields: [
4544
{ name: "Question", value: question },
4645
{ name: "Answer", value: responsePick }
47-
],
48-
footer: { text: app.config.system.footerText }
46+
]
4947
}]
5048
}, 0, true);
5149
}

src/app/cmds/Fun/cuddle.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ module.exports = {
3333
embeds: [{
3434
color: app.config.system.embedColors.lime,
3535
description: `**${sender}** cuddles **${target}**!`,
36-
image: { url: img },
37-
footer: app.config.system.footerText
36+
image: { url: img }
3837
}]
3938
});
4039

src/app/cmds/Fun/explode.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ module.exports = {
3737
{ name: "BOOM!", value: `${target} has been kaboom'd!` },
3838
{ name: "But, uh...", value: "That explosion made a huge mess..." }
3939
],
40-
image: { url: img },
41-
footer: app.config.system.footerText
40+
image: { url: img }
4241
}]
4342
});
4443

src/app/cmds/Fun/hug.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ module.exports = {
3333
embeds: [{
3434
color: app.config.system.embedColors.blue,
3535
description: `**${sender}** gave **${target}**, a hug!`,
36-
image: { url: img },
37-
footer: app.config.system.footerText
36+
image: { url: img }
3837
}]
3938
});
4039

src/app/cmds/Fun/kiss.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ module.exports = {
3333
embeds: [{
3434
color: app.config.system.embedColors.red,
3535
description: `**${sender}** kisses **${target}**!`,
36-
image: { url: img },
37-
footer: app.config.system.footerText
36+
image: { url: img }
3837
}]
3938
});
4039

src/app/cmds/Fun/pat.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ module.exports = {
3333
embeds: [{
3434
color: app.config.system.embedColors.purple,
3535
description: `**${sender}** pats **${target}**!`,
36-
image: { url: img },
37-
footer: app.config.system.footerText
36+
image: { url: img }
3837
}]
3938
});
4039

src/app/cmds/General/about.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ module.exports = {
3434
{ name: "System Platform", value: `${process.platform}`, inline: true },
3535
{ name: ((process.platform == "linux") ? "Kernel Version" : "System Version"), value: os.version(), inline: true }
3636
// I'd like to have this show the current CPU usage, I'm open to ideas on how to get it to work. - IDeletedSystem64
37-
],
38-
footer: { text: app.config.system.footerText }
37+
]
3938
}]
4039
});
4140
}

src/app/cmds/General/afk.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module.exports = {
2+
name: "afk",
3+
description: "See ya next time!",
4+
guildOnly: false,
5+
authorizedGuilds: [],
6+
hidden: false,
7+
permissions: ["DEFAULT"],
8+
cooldown: 10,
9+
aliases: [],
10+
syntax: [],
11+
execute: async(app, message, args) => {
12+
var userSettings = await app.DBs.userSettings.findOne({ where: { userID: message.author.id } });
13+
if (!userSettings) return app.functions.msgHandler(message, { embeds: [{ color: app.config.system.embedColors.red, description: `${app.config.system.emotes.error} **Could not set to AFK due to missing User Settings.**` }] })
14+
15+
var reason = args.slice(0).join(" ") || "";
16+
var AFKSettings = {
17+
"timestamp": new Date().getTime(),
18+
"reason": reason,
19+
"mentions": 0
20+
};
21+
22+
const affectedRows = await app.DBs.userSettings.update({ AFKSettings: JSON.stringify(AFKSettings, null, "\t") }, { where: { userID: message.author.id } });
23+
if (affectedRows.length > 0) {
24+
await app.functions.msgHandler(message, {
25+
embeds: [{
26+
title: `${app.config.system.emotes.success} You're now AFK${((reason != "" ? ": " + reason: "!"))}`,
27+
color: app.config.system.embedColors.lime
28+
}],
29+
author: message.author
30+
}, 0, true, (async msg => {
31+
setTimeout(function() { msg.delete() }, 6000);
32+
}));
33+
} else {
34+
return app.functions.msgHandler(message, { embeds: [{ color: app.config.system.embedColors.red, description: `${app.config.system.emotes.error} **Could not set to AFK due to Database Error!**` }] })
35+
};
36+
}
37+
};

src/app/cmds/General/help.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ module.exports = {
3232
title: `${app.config.system.emotes.information} ${app.name} Help`,
3333
color: app.config.system.embedColors.blue,
3434
description: ((temp) ? "The command or category '" + temp + "' is invalid." : `Yeaaah we got it! (Help! Help!)`),
35-
fields: fields,
36-
footer: { text: app.config.system.footerText }
35+
fields: fields
3736
}]
3837
}, 0, true);
3938
};
@@ -56,8 +55,7 @@ module.exports = {
5655
title: `${app.config.system.emotes.information} ${app.name} Help`,
5756
color: app.config.system.embedColors.pink,
5857
description: `Showing commands for the '${categoryName}' category.`,
59-
fields: fields,
60-
footer: { text: app.config.system.footerText }
58+
fields: fields
6159
}]
6260
}, 0, true);
6361
};
@@ -82,8 +80,7 @@ module.exports = {
8280
title: `${app.config.system.emotes.information} Help for ${commandName}`,
8381
color: app.config.system.embedColors.lime,
8482
description: command.description,
85-
fields: fields,
86-
footer: { text: app.config.system.footerText }
83+
fields: fields
8784
}]
8885
}, 0, true);
8986

0 commit comments

Comments
 (0)