Skip to content

Commit

Permalink
Improve genPluginList
Browse files Browse the repository at this point in the history
  • Loading branch information
Vendicated committed Oct 25, 2022
1 parent 4bddcee commit 2af324c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions scripts/genPluginList.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
// Just copy paste the entire file into a running Vencord install and it will prompt you
// to save the file

// eslint-disable-next-line spaced-comment
/// <reference types="../src/modules"/>

(() => {
// eslint-disable-next-line spaced-comment
/// <reference types="../src/modules"/>
/**
* @type {typeof import("~plugins").default}
*/
Expand All @@ -39,7 +40,7 @@
let list = "\n\n";

for (const p of Object.values(Plugins).sort((a, b) => a.name.localeCompare(b.name))) {
tableOfContents += `- [${p.name}](#${encodeURIComponent(p.name)})\n`;
tableOfContents += `- [${p.name}](#${p.name.replaceAll(" ", "-")})\n`;

list += `## ${p.name}
Expand All @@ -49,17 +50,14 @@ ${p.description}
`;

if (p.commands?.length) {
list += "\n\n### Commands\n";
list += "\n\n#### Commands\n";
for (const cmd of p.commands) {
list += `${cmd.name} - ${cmd.description}\n\n`;
}
}
list += "\n\n";
}

const data = new Blob([header.trimStart(), tableOfContents, list.trimEnd()], { type: "text/plain" });
data.arrayBuffer().then(buf =>
DiscordNative.fileManager.saveWithDialog(new Uint8Array(buf), "plugins.md")
);

const data = new TextEncoder().encode(header + tableOfContents + list);
DiscordNative.fileManager.saveWithDialog(data, "plugins.md");
})();

0 comments on commit 2af324c

Please sign in to comment.