const fs = require("fs");

exports.run = async (client, message, [type, ...Message]) => {    
    let records = JSON.parse(fs.readFileSync("records.json", "utf8"));
    let settings = require("../../settings.json");
    type = type.toLowerCase();
    let user = message.author;
    let report = records[settings.ownerID];
    Message = Message.join(" ");
    let color = null;
    let Type = null;

    if (!Message) { return message.reply("Your report failed to include a message! Nothing gets done without an explaination!"); }
    if (type === "todo" && message.author.id !== settings.ownerID) { return message.reply("I'm sorry only the bot owner can add things to the todo list."); }

    if (type === "issue") { 
        color = "#FF0000"; 
        Type = "Issue";
    } if (type === "bug") { 
        color = "#FFFF00";
        Type = "Bug";
    } if (type === "improvement") { 
        color = "#FFA500";
        Type = "Improvement";
    } if (type === "complaint") { 
        color = "#DB3E17";
        Type = "Complaint"; 
    } if (type === "todo") {
        color = "#4d5fd";
        Type = "Todo";
    } else { 
        return message.reply("You provided a false value. Please use either `issue`, `bug`, `improvement`, `complaint` as a type!");
    }

    const embed = new client.methods.Embed()
		.setColor(color)
        .setTimestamp()
        .setTitle(`${Type} Report: ${report.report}`)
        .setDescription("A user has filed a report!")
        .addField(`User: ${user.tag}`, `From: ${message.guild.name}`)
        .addField("Message:", `${Message}`)
        .setThumbnail(user.avatarURL());
    
    const DMembed = new client.methods.Embed()
      .setColor(0x00AE86)
      .setTimestamp()
      .setTitle("Report confirmation:")
      .setDescription(`Your report has been sent! Report number: ${report.report}
      \nIssue: ${Message}
      \nAny more questions, please ask Butterstroke#7150!`);
      /*.setDescription(`Your report has been sent! Report number: ${report.report}
      \nIf you have any more questions, feel free to talk with our support team on my server! It's the best, fastest, and easiest way to get in contact! https://discord.gg/VQ4vrvt`);
*/
    await report.report++;
    await message.delete().catch();
    await client.users.get(user.id).send({embed: DMembed});
    await client.channels.get("353381124250140682").send({embed});
    await fs.writeFile("records.json", JSON.stringify(records), (err) => {
        if (err) { 
            console.error(err);
            return message.reply("There has been an error upon processing the report. I have sent an error log to the developers to fix. Please try reporting at a later time.");
        } 
    });
    return await message.reply("Report sent! A DM has been sent with your report number.");
};
  
exports.conf = {
      enabled: true,
      runIn: ["text"],
      aliases: ["issue"],
      permLevel: 0,
      botPerms: [],
      requiredFuncs: [],
      cooldown: 300,
};
    
exports.help = {
      name: "report",
      description: "File a report to the bot developers about Margarine. (ie: Bug, issue, complaint)",
      usage: "<type:str> [Message:str]",
      usageDelim: " ",
};

@@ -63,17 +63,16 @@
 e, %5B
-type, ...
+option, 
 Mess
@@ -216,19 +216,25 @@
     
+let 
 type = 
-type
+option
 .toL
@@ -322,41 +322,15 @@
 rID%5D
-;%0A    Message = Message.join(%22 %22)
+.report
 ;%0A  
@@ -348,20 +348,16 @@
  = null;
-%0A   
  let Typ
@@ -735,32 +735,37 @@
 = %22Issue%22;%0A    %7D
+ else
  if (type === %22b
@@ -818,32 +818,37 @@
 e = %22Bug%22;%0A    %7D
+ else
  if (type === %22i
@@ -921,24 +921,29 @@
 ment%22;%0A    %7D
+ else
  if (type ==
@@ -1021,16 +1021,21 @@
 ; %0A    %7D
+ else
  if (typ
@@ -1298,17 +1298,16 @@
 Embed()%0A
-%09
 %09.setCol
@@ -1383,23 +1383,16 @@
 $%7Breport
-.report
 %7D%60)%0A    
@@ -1801,39 +1801,32 @@
 number: $%7Breport
-.report
 %7D%0A      %5CnIssue:
@@ -1902,294 +1902,44 @@
 %60);%0A
-      /*.setDescription(%60Your report has been sent! Report number: $%7Breport.report%7D%0A      %5CnIf you have any more questions, feel free to talk with our support team on my server! It's the best, fastest, and easiest way to get in contact! https://discord.gg/VQ4vrvt%60);%0A*/%0A    await report
+%0A    await records%5Bsettings.ownerID%5D
 .rep
@@ -2868,20 +2868,22 @@
 sage: %22%3C
-type
+option
 :str%3E %5BM
@@ -2915,15 +2915,17 @@
 Delim: %22
+ %7C
  %22,%0A%7D;%0A

Update report.js