From 080d20396bd9998eeb596741bfff9ea9bda07931 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sat, 27 Aug 2022 21:40:53 -0600 Subject: [PATCH] fix help spacing, add clear --- README.md | 5 +++++ src/index.js | 25 +++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ef81180..fe7ddad 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,11 @@ You **MUST** grant your bot all Privileged Gateway Intents. - [ ] Creation date, join date, ID, etc - [x] Room history (r) - [x] Extended room history (R) + - [ ] List channels (l) + - [x] List guilds (L) + - [x] Clear (c) + - [ ] Surf channels forwards (>) + - [ ] Surf channels backwards (<) - [x] Message Receiving - [ ] Markdown styling - [ ] Common markdown (bold, italic, etc) diff --git a/src/index.js b/src/index.js index 9becf8d..0bf8eed 100644 --- a/src/index.js +++ b/src/index.js @@ -30,9 +30,11 @@ const commands = { w: "who is in guild", f: "finger", r: "channel history", - R: "extended channel history", + R: "extended history", h: "command help", c: "clear", + "<": "surf backwards", + ">": "surf forwards", }; const client = new Eris("Bot " + token, { @@ -262,17 +264,18 @@ function showHelp() { console.log("\nCOMcord (c)left 2022\n"); const keys = Object.keys(commands); - keys.sort(); + keys.sort((a, b) => a.localeCompare(b)); let index = 0; for (const key of keys) { const desc = commands[key]; + const length = ` ${key} - ${desc}`.length; stdout.write( - (" " + chalk.bold.yellow(key) + chalk.reset(" - " + desc)).padEnd( - 25, - " " - ) + " " + + chalk.bold.yellow(key) + + chalk.reset(" - " + desc) + + " ".repeat(Math.abs(25 - length)) ); index++; @@ -702,6 +705,16 @@ stdin.on("data", function (key) { startExtendedHistory(); break; } + case "c": { + console.clear(); + break; + } + case "<": { + break; + } + case ">": { + break; + } case " ": case "\r": default: {