initial commit

This commit is contained in:
Cynthia Foxwell 2022-08-27 17:27:05 -06:00
parent 9b8bf162b8
commit ff0e34f836
5 changed files with 145 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

52
README.md Normal file
View File

@ -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 <token>`
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

12
package.json Normal file
View File

@ -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"
}
}

49
pnpm-lock.yaml Normal file
View File

@ -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

31
src/index.js Normal file
View File

@ -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();