Push Old Dizzy AU messages (from Discord) #1

Closed
opened 2022-05-27 03:58:19 +00:00 by MeowcaTheoRange · 1 comment
MeowcaTheoRange commented 2022-05-27 03:58:19 +00:00 (Migrated from git.gay)

Self-explanatory. Push some old messages into the repository in order to keep the history together.

Self-explanatory. Push some old messages into the repository in order to keep the history together.
MeowcaTheoRange commented 2022-05-28 03:39:22 +00:00 (Migrated from git.gay)

It has been done, using this simple script to convert a specific format of JSON to this dumb MD file. As well as some human intervetion, afterwards.

const fs = require("fs");

var json = JSON.parse(fs.readFileSync("./read.json", { encoding: "utf8" })).chatlog.reverse();
var markdown = "";

for (i in json) {
  var everyThing = json[i].MSG.split("\n");
  everyThing.forEach((e, i, a) => {
    a[i] = "> " + e
  });
  if (json[i].AUTH == "Exposition") {
    markdown += `\n\n# ${json[i].MSG}`
  } else if (json[i].AUTH == "Narrator") {
    if (json[i - 1] != undefined && json[i - 1].AUTH == json[i].AUTH) {
      markdown += `\n\n${everyThing.join("\n\n")}`
    } else {
      markdown += `\n\n### ---
\n\n${everyThing.join("\n\n")}`
    }
  } else {
    if (json[i - 1] != undefined && json[i - 1].AUTH == json[i].AUTH) {
      markdown += `\n\n${everyThing.join("\n\n")}`
    } else {
      markdown += `\n\n### ${json[i].AUTH}
\n\n${everyThing.join("\n\n")}`
    }
  }
}

fs.writeFileSync("./output.md", markdown, {encoding: "utf8"});
It has been done, using this simple script to convert a specific format of JSON to this dumb MD file. As well as some human intervetion, afterwards. ```js const fs = require("fs"); var json = JSON.parse(fs.readFileSync("./read.json", { encoding: "utf8" })).chatlog.reverse(); var markdown = ""; for (i in json) { var everyThing = json[i].MSG.split("\n"); everyThing.forEach((e, i, a) => { a[i] = "> " + e }); if (json[i].AUTH == "Exposition") { markdown += `\n\n# ${json[i].MSG}` } else if (json[i].AUTH == "Narrator") { if (json[i - 1] != undefined && json[i - 1].AUTH == json[i].AUTH) { markdown += `\n\n${everyThing.join("\n\n")}` } else { markdown += `\n\n### --- \n\n${everyThing.join("\n\n")}` } } else { if (json[i - 1] != undefined && json[i - 1].AUTH == json[i].AUTH) { markdown += `\n\n${everyThing.join("\n\n")}` } else { markdown += `\n\n### ${json[i].AUTH} \n\n${everyThing.join("\n\n")}` } } } fs.writeFileSync("./output.md", markdown, {encoding: "utf8"}); ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: MeowcaTheoRange/Dizzy-AU#1
No description provided.