From ff0e34f83657d46ac0f597252e64abf93b3338ed Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sat, 27 Aug 2022 17:27:05 -0600 Subject: [PATCH] initial commit --- .gitignore | 1 + README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 12 ++++++++++++ pnpm-lock.yaml | 49 +++++++++++++++++++++++++++++++++++++++++++++++ src/index.js | 31 ++++++++++++++++++++++++++++++ 5 files changed, 145 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 src/index.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..122bfc6 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# comcord +A CLI-based client for Discord inspired by [SDF](https://sdf.org)'s [commode](https://sdf.org/?tutorials/comnotirc). + +## Why? +1. All CLI/TUI Discord clients are outdated/unmaintained or have flaws. +2. I've been spending more time in commode on SDF and have been accustomed to the experience. + +## Usage +1. `pnpm i` +2. `node src/index.js ` + +Currently only bot accounts are supported, and that is unlikely to change anytime soon. +Eris has a lot of user-only endpoints implemented, but it would require hacking apart Eris to do the things nessicary to spoof being the actual client. +I also don't want to give skids an easy point of reference of how to spoof the client. :^) + +You **MUST** grant your bot all Privileged Gateway Intents. + +## Design Decisions +* Node.js was chosen currently due to familiarity. +* Eris was chosen due to familiarity and the nature of everything not being abstracted out to 200 different classes unlike discord.js. +* "Jank" by design. While I don't expect anyone to actually use comcord on serial terminals or teletypes other than for meme factor, the option is still there. + +## TODO +- [ ] Commands + - [ ] Quit (q) + - [ ] Switch guilds (G) + - [ ] Switch channels (g) + - [ ] List online users in guild (w) + - [ ] Emote (e) + - Just sends message surrounded in `*`'s + - [ ] Finger (f) + - [ ] Shows presence data if available + - [ ] Creation date, join date, ID, etc + - [ ] Room history (r) + - [ ] Extended room history (R) +- [ ] Message Receiving + - [ ] Markdown styling + - [ ] Common markdown (bold, italic, etc) + - [ ] Figure out how spoilers would work + - [ ] Emotes????? + - [ ] Timestamp parsing + - [ ] Embeds in the style of commode's posted links + - [ ] Messages wrapped in `*`'s or `_`'s parsed as emotes + - [ ] Inline DMs to replicate commode's private messages + - [ ] Replies +- [ ] Message sending + - [ ] Puts incoming messages into queue whilst in send mode + - [ ] Mentions + - [ ] Replies +- [ ] Configuration + - [ ] Default guild/channel +- [ ] Threads diff --git a/package.json b/package.json new file mode 100644 index 0000000..95f6409 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "comcord", + "version": "1.0.0", + "description": "", + "main": "index.js", + "keywords": [], + "author": "Cynosphere", + "license": "MIT", + "dependencies": { + "eris": "github:abalabahaha/eris#dev" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..e1e4dc1 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,49 @@ +lockfileVersion: 5.4 + +specifiers: + eris: github:abalabahaha/eris#dev + +dependencies: + eris: github.com/abalabahaha/eris/eb403730855714eafa36c541dbe2cb84c9979158 + +packages: + + /opusscript/0.0.8: + resolution: {integrity: sha512-VSTi1aWFuCkRCVq+tx/BQ5q9fMnQ9pVZ3JU4UHKqTkf0ED3fKEPdr+gKAAl3IA2hj9rrP6iyq3hlcJq3HELtNQ==} + requiresBuild: true + dev: false + optional: true + + /tweetnacl/1.0.3: + resolution: {integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==} + requiresBuild: true + dev: false + optional: true + + /ws/8.8.1: + resolution: {integrity: sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: false + + github.com/abalabahaha/eris/eb403730855714eafa36c541dbe2cb84c9979158: + resolution: {tarball: https://codeload.github.com/abalabahaha/eris/tar.gz/eb403730855714eafa36c541dbe2cb84c9979158} + name: eris + version: 0.17.2-dev + engines: {node: '>=10.4.0'} + dependencies: + ws: 8.8.1 + optionalDependencies: + opusscript: 0.0.8 + tweetnacl: 1.0.3 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..1f518d9 --- /dev/null +++ b/src/index.js @@ -0,0 +1,31 @@ +const Eris = require("eris"); +const token = process.argv[2]; + +let currentGuild, + currentChannel, + inSendMode = false; + +const messageQueue = []; + +const client = new Eris("Bot " + token, { + defaultImageFormat: "png", + defaultImageSize: 1024, + intents: Eris.Constants.Intents.all, +}); + +client.once("ready", function () { + console.log( + `Logged in as: ${client.user.username}#${client.user.discriminator} (${client.user.id})` + ); +}); + +client.on("messageCreate", function (msg) { + if (msg.channel.id == currentChannel) { + if (inSendMode) { + messageQueue.push(msg); + } else { + } + } +}); + +client.connect();