Skip to content

Commit f6155ca

Browse files
install eslint + styling/semicolons (#1)
* ignore reports * 4 space * eslint * eslint fix * EXPAND Co-authored-by: KryptoCrash <[email protected]>
1 parent ca0de91 commit f6155ca

File tree

18 files changed

+1155
-210
lines changed

18 files changed

+1155
-210
lines changed

.eslintrc.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
{
22
"env": {
3+
"commonjs": true,
34
"es6": true,
45
"node": true
56
},
67
"extends": "eslint:recommended",
8+
"globals": {
9+
"Atomics": "readonly",
10+
"SharedArrayBuffer": "readonly"
11+
},
712
"parserOptions": {
8-
"sourceType": "module"
13+
"ecmaVersion": 11
914
},
1015
"rules": {
11-
"no-console": "off",
1216
"indent": [
1317
"error",
14-
2
18+
4
1519
],
1620
"linebreak-style": [
1721
"error",
1822
"windows"
1923
],
2024
"quotes": [
21-
"warn",
25+
"error",
2226
"double"
2327
],
2428
"semi": [
25-
"warn",
29+
"error",
2630
"always"
2731
]
2832
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ reports.json
6464

6565
#Node
6666
node_modules/
67+
reports.json

bot.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ fs.readdir("./commands/", (err, files) => {
1515
}
1616
// console.log(`\nLoading ${jsfiles.length} commands!\n`)
1717

18-
jsfiles.forEach((f, i) => {
18+
jsfiles.forEach(f => {
1919
let props = require(`./commands/${f}`);
20-
// console.log(`${i + 1}: ${f} loaded!`);
2120
bot.commands.set(props.help.name, props);
2221
});
2322

commands/acceptReport.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const Discord = require("discord.js");
22
const colors = require("../colors.json");
33
const BugReport = require("../utils/bugReport.js");
44
const fs = require("fs");
5-
const botSettings = require("../botsettings.json")
5+
const botSettings = require("../botsettings.json");
66
const pending_channelid = botSettings.channelid_pendingbugs;
77
const prefix = botSettings.prefix;
88
const reasonlimit = botSettings.reasonlimit;
@@ -14,32 +14,32 @@ const reasonlimit = botSettings.reasonlimit;
1414
*/
1515
module.exports.run = async (bot, message, args) => {
1616
let bugReportID = args[0];
17-
let reason = args.slice(1).join(' ');
17+
let reason = args.slice(1).join(" ");
1818
let acceptor = message.author.tag;
1919
let acceptorID = message.author.id;
2020
let channel = message.channel;
2121

2222
if(channel.id !== pending_channelid) {
23-
return error(`ERROR: Incorrect usage. Please use this command in the <#${pending_channelid}> channel.`)
23+
return error(`ERROR: Incorrect usage. Please use this command in the <#${pending_channelid}> channel.`);
2424
}
2525
if(!bugReportID || !reason) {
26-
return error(`ERROR: Incorrect usage. Run this command with the following format: \`${prefix}accept report_id reason\``)
26+
return error(`ERROR: Incorrect usage. Run this command with the following format: \`${prefix}accept report_id reason\``);
2727
}
2828
if(reason.length > reasonlimit) {
2929
return error(`ERROR: Reason too long. It must be less than ${reasonlimit} characters.`)
3030
}
3131
if(reason.includes("`")) {
32-
return error("ERROR: Reason cannot contain the ` character.")
32+
return error("ERROR: Reason cannot contain the ` character.");
3333
}
3434

3535
fs.readFile("./reports.json", "utf8", (err, data) => {
3636
if(err) {
3737
console.error(err);
38-
return error(`ERROR: Read from database failed. Please send the following message to Whimpers: (${err})`)
38+
return error(`ERROR: Read from database failed. Please send the following message to Whimpers: (${err})`);
3939
}
4040
const reportsArr = JSON.parse(data);
4141
const report = reportsArr.find(report => report.id === bugReportID);
42-
if(!report) {
42+
if (!report) {
4343
return error(`ERROR: No bug report found with id: \`${bugReportID}\`.`);
4444
}
4545
if((report.acceptersList.length + report.deniersList.length) > (800 / reasonlimit)) {
@@ -52,32 +52,32 @@ module.exports.run = async (bot, message, args) => {
5252
}
5353
BugReport.accept(report, acceptance, acceptorID, bot)
5454
const reportsJSON = JSON.stringify(reportsArr);
55-
fs.writeFile('./reports.json', reportsJSON, 'utf8', err => {
55+
fs.writeFile("./reports.json", reportsJSON, "utf8", err => {
5656
if(err) {
5757
console.error(err);
58-
return error(`ERROR: Write to database failed. Please send the following message to Whimpers: (${err})`)
58+
return error(`ERROR: Write to database failed. Please send the following message to Whimpers: (${err})`);
5959
}
6060
});
61-
})
61+
});
6262
message.delete(0);
6363

6464
// Error Handler
6565

6666
function error(errorMessage) {
6767
const errorEmbed = new Discord.RichEmbed()
68-
.setAuthor('Reviewer -', bot.avatarURL)
68+
.setAuthor("Reviewer -", bot.avatarURL)
6969
.setTitle("ERROR")
7070
.setDescription(`${errorMessage}\nBug acceptance process halted. Please run the command again to restart your report.`)
71-
.setColor(colors.error)
71+
.setColor(colors.error);
7272
channel.send(errorEmbed).then(msg => {
73-
message.delete(0)
74-
msg.delete(5000)
73+
message.delete(0);
74+
msg.delete(5000);
7575
});
7676
}
77-
}
77+
};
7878

7979

8080
module.exports.help = {
8181
name: "accept",
8282
description:`Accepts a bug report. Can only be run in <#${pending_channelid}> channel by bug hunters.`
83-
}
83+
};

commands/addCommand.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports.run = async (bot, message, args) => {
2-
2+
33
}
44

55

commands/denyReport.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@ const reasonlimit = botSettings.reasonlimit;
1414
*/
1515
module.exports.run = async (bot, message, args) => {
1616
let bugReportID = args[0];
17-
let reason = args.slice(1).join(' ');
17+
let reason = args.slice(1).join(" ");
1818
let denier = message.author.tag;
1919
let denierID = message.author.id;
2020
let channel = message.channel;
2121

2222

2323
if(channel.id !== pending_channelid) {
24-
return error(`ERROR: Incorrect usage. Please use this command in the <#${pending_channelid}> channel.`)
24+
return error(`ERROR: Incorrect usage. Please use this command in the <#${pending_channelid}> channel.`);
2525
}
2626
if(!bugReportID || !reason) {
27-
return error(`ERROR: Incorrect usage. Run this command with the following format: \`${prefix}deny report_id reason\``)
27+
return error(`ERROR: Incorrect usage. Run this command with the following format: \`${prefix}deny report_id reason\``);
2828
}
2929
if(reason.length > reasonlimit) {
3030
return error(`ERROR: Reason too long. It must be less than ${reasonlimit} characters.`)
3131
}
3232
if(reason.includes("`")) {
33-
return error("ERROR: Reason cannot contain the ` character.")
33+
return error("ERROR: Reason cannot contain the ` character.");
3434
}
3535

3636
fs.readFile("./reports.json", "utf8", (err, data) => {
3737
if(err) {
3838
console.error(err);
39-
return error(`ERROR: Read from database failed. Please send the following message to Whimpers: (${err})`)
39+
return error(`ERROR: Read from database failed. Please send the following message to Whimpers: (${err})`);
4040
}
4141
const reportsArr = JSON.parse(data);
4242
const report = reportsArr.find(report => report.id === bugReportID);
@@ -53,32 +53,32 @@ module.exports.run = async (bot, message, args) => {
5353
}
5454
BugReport.decline(report, rejectance, denierID, bot)
5555
const reportsJSON = JSON.stringify(reportsArr);
56-
fs.writeFile('./reports.json', reportsJSON, 'utf8', err => {
56+
fs.writeFile("./reports.json", reportsJSON, "utf8", err => {
5757
if(err) {
5858
console.error(err);
59-
return error(`ERROR: Write to database failed. Please send the following message to Whimpers: (${err})`)
59+
return error(`ERROR: Write to database failed. Please send the following message to Whimpers: (${err})`);
6060
}
6161
});
62-
})
62+
});
6363
message.delete(0);
6464

6565
// Error Handler
6666

6767
function error(errorMessage) {
6868
const errorEmbed = new Discord.RichEmbed()
69-
.setAuthor('Reviewer -', bot.avatarURL)
69+
.setAuthor("Reviewer -", bot.avatarURL)
7070
.setTitle("ERROR")
7171
.setDescription(`${errorMessage}\nBug denial process halted. Please run the command again to restart your report.`)
72-
.setColor(colors.error)
72+
.setColor(colors.error);
7373
channel.send(errorEmbed).then(msg => {
74-
message.delete(0)
75-
msg.delete(5000)
74+
message.delete(0);
75+
msg.delete(5000);
7676
});
7777
}
78-
}
78+
};
7979

8080

8181
module.exports.help = {
8282
name: "deny",
8383
description:`Denies a bug report. Can only be run in <#${pending_channelid}> channel by bug hunters.`
84-
}
84+
};

commands/hackinfo.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ const colors = require("../colors.json");
88
*/
99
module.exports.run = async (bot, message, args) => {
1010
let supportEmbed = new Discord.RichEmbed()
11-
.setAuthor('Reviewer -', bot.avatarURL)
11+
.setAuthor("Reviewer -", bot.avatarURL)
1212
.setTitle("SUPPORT")
13-
.setDescription(`All of our hacks are listed on our github, which can be accessed in the <#683847137511079959> channel. You can also watch this video for a full tutorial on how to hack: https://www.youtube.com/watch?v=DMwDyV9mmsM`)
14-
.setColor(colors.info)
15-
message.channel.send(supportEmbed)
16-
}
13+
.setDescription("All of our hacks are listed on our github, which can be accessed in the <#683847137511079959> channel. You can also watch this video for a full tutorial on how to hack: https://www.youtube.com/watch?v=DMwDyV9mmsM")
14+
.setColor(colors.info);
15+
message.channel.send(supportEmbed);
16+
};
1717

1818

1919
module.exports.help = {
2020
name: "hackinfo",
2121
description:"Instructions on how to hack."
22-
}
22+
};

commands/help.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
const { RichEmbed } = require("discord.js");
2-
const botSettings = require("../botsettings.json")
3-
const colors = require("../colors.json")
2+
const colors = require("../colors.json");
3+
44
module.exports.run = async (bot, message, args) => {
5-
let commands = [];
6-
bot.commands.forEach(c => {
7-
if (c.help.description === undefined) c.help.description = "Description not set";
8-
commands.push(c.help.name + ": "+ c.help.description);
9-
});
10-
commands = commands.join("\n\n");
11-
let helpEmbed = new RichEmbed()
12-
.setColor(colors.info)
13-
.setDescription(commands)
14-
.setTimestamp()
15-
.setFooter("Requested by: " + message.author.tag, message.author.displayAvatarURL);
16-
message.channel.send({embed: helpEmbed})
5+
let commands = [];
6+
bot.commands.forEach(c => {
7+
if (c.help.description === undefined) c.help.description = "Description not set";
8+
commands.push(c.help.name + ": "+ c.help.description);
9+
});
10+
commands = commands.join("\n\n");
11+
let helpEmbed = new RichEmbed()
12+
.setColor(colors.info)
13+
.setDescription(commands)
14+
.setTimestamp()
15+
.setFooter("Requested by: " + message.author.tag, message.author.displayAvatarURL);
16+
message.channel.send({embed: helpEmbed});
1717
};
1818

1919
exports.help = {
20-
name:"help",
21-
description:"Sends this help message.",
22-
category: ""
20+
name:"help",
21+
description:"Sends this help message.",
22+
category: ""
2323
};

commands/report.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,40 @@ module.exports.run = async (bot, message, args) => {
1313
const channel = message.channel;
1414

1515
const bugFormDialogue = {
16-
name: `Please enter the name of the affected script/hack.`,
17-
desc: `Please write a short description about the bug.`,
18-
reproSteps: `Please write out the steps needed to reproduce the error. Seperate each step by a comma.`,
19-
expectedResult: `Please enter the expected result of the script. (The one that would occur if the bug were fixed.)`,
20-
actualResult: `Please enter the actual result of the script. (The one that occurs now.)`
21-
}
16+
name: "Please enter the name of the affected script/hack.",
17+
desc: "Please write a short description about the bug.",
18+
reproSteps: "Please write out the steps needed to reproduce the error. Seperate each step by a comma.",
19+
expectedResult: "Please enter the expected result of the script. (The one that would occur if the bug were fixed.)",
20+
actualResult: "Please enter the actual result of the script. (The one that occurs now.)"
21+
};
2222

2323
if(bot.reporting.has(member.id)) return;
2424
if(channel.type != "dm") {
2525
message.delete(0);
26-
return error("ERROR: Please run this command in a DM.")
26+
return error("ERROR: Please run this command in a DM.");
2727
} else {
28-
bot.reporting.add(member.id)
29-
await bugForm(channel)
30-
bot.reporting.delete(member.id)
28+
bot.reporting.add(member.id);
29+
await bugForm(channel);
30+
bot.reporting.delete(member.id);
3131

3232
const confirmationEmbed = new Discord.RichEmbed()
33-
.setAuthor('Reviewer -', bot.avatarURL)
33+
.setAuthor("Reviewer -", bot.avatarURL)
3434
.setTitle("SUCCESS")
35-
.setDescription(`Your bug report has been successfully sent! If it gets accepted, you can become a bug hunter! :tada:`)
35+
.setDescription("Your bug report has been successfully sent! If it gets accepted, you can become a bug hunter! :tada:")
3636
.setColor(colors.valid);
37-
await channel.send(confirmationEmbed)
37+
await channel.send(confirmationEmbed);
3838
}
3939

4040
// Ask for additional information for bug submission
4141
async function bugForm(channel) {
4242
let dialogueResults = [];
4343
for (const line of Object.entries(bugFormDialogue)) {
4444
const dialogueEmbed = new Discord.RichEmbed()
45-
.setAuthor('Reviewer -', bot.avatarURL)
46-
.setTitle("BUG REPORT FORM")
47-
.setDescription(line)
45+
.setAuthor("Reviewer -", bot.avatarURL)
46+
.setTitle("BUG REPORT FORM")
47+
.setDescription(line)
4848
.setColor(colors.info);
49-
await channel.send(dialogueEmbed).then(async () => await waitForResponse(dialogueResults))
49+
await channel.send(dialogueEmbed).then(async () => await waitForResponse(dialogueResults));
5050
}
5151

5252
let report = new BugReport(member, ...dialogueResults);
@@ -58,9 +58,9 @@ module.exports.run = async (bot, message, args) => {
5858
collected.forEach(async (msg) => {
5959
await Promise.resolve(
6060
filter(msg) ? msg.content : await waitForResponse(dialogueResults)
61-
).then(val => dialogueResults.push(val.slice(0, 800)))
62-
})
63-
})
61+
).then(val => dialogueResults.push(val.slice(0, 800)));
62+
});
63+
});
6464
}
6565
// Submit to bug queue with unique id
6666
async function submit(bugReport) {
@@ -71,27 +71,27 @@ module.exports.run = async (bot, message, args) => {
7171
reportsArr.push(bugReport);
7272

7373
const reportsJSON = JSON.stringify(reportsArr);
74-
fs.writeFile('./reports.json', reportsJSON, 'utf8', err => {
75-
if(err) console.error(err)
74+
fs.writeFile("./reports.json", reportsJSON, "utf8", err => {
75+
if(err) console.error(err);
7676
});
77-
})
77+
});
7878
}
7979

8080
// Error Handler
8181

8282
function error(errorMessage) {
8383
const errorEmbed = new Discord.RichEmbed()
84-
.setAuthor('Reviewer -', bot.avatarURL)
84+
.setAuthor("Reviewer -", bot.avatarURL)
8585
.setTitle("ERROR")
8686
.setDescription(`${errorMessage}\nBug reporting process halted. Please run the command again to restart your report.`)
87-
.setColor(colors.error)
87+
.setColor(colors.error);
8888
channel.send(errorEmbed).then(msg => msg.delete(5000));
8989
return new Error(errorMessage);
9090
}
91-
}
91+
};
9292

9393

9494
module.exports.help = {
9595
name: "report",
9696
description:"Issues a new bug report. Can only be run in a DM with the Reviewer bot."
97-
}
97+
};

0 commit comments

Comments
 (0)