oceanic -> dysnomia
This commit is contained in:
parent
95fca1c026
commit
4b91a1e7e9
14 changed files with 169 additions and 222 deletions
15
README.md
15
README.md
|
@ -8,14 +8,15 @@ A CLI-based client for Discord inspired by [SDF](https://sdf.org)'s [commode](ht
|
||||||
## Usage
|
## Usage
|
||||||
1. `pnpm i`
|
1. `pnpm i`
|
||||||
2. `node src/index.js <token>`
|
2. `node src/index.js <token>`
|
||||||
|
|
||||||
Your token will be then stored in `.comcordrc` after the first launch.
|
Your token will be then stored in `.comcordrc` after the first launch.
|
||||||
|
|
||||||
### User Accounts
|
### User Accounts
|
||||||
User accounts are *partially* supported via `allowUserAccounts=true` in your `.comcordrc`.
|
User accounts are _partially_ supported via `allowUserAccounts=true` in your `.comcordrc`.
|
||||||
This is use at your own risk, despite spoofing the official client. I am not responsible for any banned accounts.
|
This is use at your own risk, despite spoofing the official client. I am not responsible for any banned accounts.
|
||||||
|
|
||||||
#### Guild members not populating
|
#### Guild members not populating
|
||||||
This is due to Oceanic not implementing Lazy Guilds as they are user account specific. **DO NOT bother Oceanic to implement it!** They are purely a bot-focused library.
|
This is due to most libraries not implementing Lazy Guilds, as bots do not need lazy guilds to function.
|
||||||
|
|
||||||
If you are willing to implement Lazy Guilds based off of [unofficial documentation](https://luna.gitlab.io/discord-unofficial-docs/lazy_guilds.html)
|
If you are willing to implement Lazy Guilds based off of [unofficial documentation](https://luna.gitlab.io/discord-unofficial-docs/lazy_guilds.html)
|
||||||
and my already existing horrible hacks to make user accounts work in the first place, feel free to send a PR (on GitLab, GitHub repo is a read only mirror).
|
and my already existing horrible hacks to make user accounts work in the first place, feel free to send a PR (on GitLab, GitHub repo is a read only mirror).
|
||||||
|
@ -24,9 +25,9 @@ and my already existing horrible hacks to make user accounts work in the first p
|
||||||
You **MUST** grant your bot all Privileged Gateway Intents.
|
You **MUST** grant your bot all Privileged Gateway Intents.
|
||||||
|
|
||||||
## Design Decisions
|
## Design Decisions
|
||||||
* Node.js was chosen currently due to familiarity.
|
- Node.js was chosen currently due to familiarity.
|
||||||
* Oceanic was chosen due to familiarity and the nature of everything not being abstracted out to 200 different classes unlike discord.js.
|
- Dysnomia 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.
|
- "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
|
## TODO
|
||||||
- [x] Commands
|
- [x] Commands
|
||||||
|
@ -70,3 +71,7 @@ You **MUST** grant your bot all Privileged Gateway Intents.
|
||||||
- [ ] Threads
|
- [ ] Threads
|
||||||
- [x] Not have the token just be in argv
|
- [x] Not have the token just be in argv
|
||||||
- [x] Not have everything in one file
|
- [x] Not have everything in one file
|
||||||
|
|
||||||
|
## Repository
|
||||||
|
If you're viewing this on GitHub or GitLab, you are viewing a read only mirror.
|
||||||
|
The main repository is located on [Gitdab](https://gitdab.com/Cynosphere/comcord) and is push mirrored to the other two.
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
"author": "Cynosphere",
|
"author": "Cynosphere",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@projectdysnomia/dysnomia": "^0.1.2",
|
||||||
"chalk": "4.1.2",
|
"chalk": "4.1.2",
|
||||||
"discord-rpc": "^4.0.1",
|
"discord-rpc": "^4.0.1"
|
||||||
"oceanic.js": "^1.1.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
173
pnpm-lock.yaml
173
pnpm-lock.yaml
|
@ -1,71 +1,66 @@
|
||||||
lockfileVersion: 5.4
|
lockfileVersion: '6.0'
|
||||||
|
|
||||||
specifiers:
|
|
||||||
chalk: 4.1.2
|
|
||||||
discord-rpc: ^4.0.1
|
|
||||||
oceanic.js: ^1.1.2
|
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
chalk: 4.1.2
|
'@projectdysnomia/dysnomia':
|
||||||
discord-rpc: 4.0.1
|
specifier: ^0.1.2
|
||||||
oceanic.js: 1.1.2
|
version: 0.1.2
|
||||||
|
chalk:
|
||||||
|
specifier: 4.1.2
|
||||||
|
version: 4.1.2
|
||||||
|
discord-rpc:
|
||||||
|
specifier: ^4.0.1
|
||||||
|
version: 4.0.1
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
/@discordjs/voice/0.11.0:
|
/@projectdysnomia/dysnomia@0.1.2:
|
||||||
resolution: {integrity: sha512-6+9cj1dxzBJm7WJ9qyG2XZZQ8rcLl6x2caW0C0OxuTtMLAaEDntpb6lqMTFiBg/rDc4Rd59g1w0gJmib33CuHw==}
|
resolution: {integrity: sha512-F64G64JwFWn/QUFqkhsyBvXJ0Du3E6Y0yu8tSrcukAnSeW8qV+reKqeQnMmHcQWYopwuYM8Q6OF/VX6VKggtOA==}
|
||||||
engines: {node: '>=16.9.0'}
|
engines: {node: '>=10.4.0'}
|
||||||
requiresBuild: true
|
peerDependencies:
|
||||||
|
'@discordjs/opus': ^0.9.0
|
||||||
|
erlpack: github:discord/erlpack || github:abalabahaha/erlpack
|
||||||
|
eventemitter3: ^5.0.0
|
||||||
|
pako: ^2.1.0
|
||||||
|
sodium-native: ^4.0.1
|
||||||
|
zlib-sync: ^0.1.8
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@discordjs/opus':
|
||||||
|
optional: true
|
||||||
|
erlpack:
|
||||||
|
optional: true
|
||||||
|
eventemitter3:
|
||||||
|
optional: true
|
||||||
|
pako:
|
||||||
|
optional: true
|
||||||
|
sodium-native:
|
||||||
|
optional: true
|
||||||
|
zlib-sync:
|
||||||
|
optional: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/ws': 8.5.3
|
ws: 8.13.0
|
||||||
discord-api-types: 0.36.3
|
optionalDependencies:
|
||||||
prism-media: 1.3.4
|
opusscript: 0.0.8
|
||||||
tslib: 2.4.0
|
tweetnacl: 1.0.3
|
||||||
ws: 8.9.0
|
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@discordjs/opus'
|
|
||||||
- bufferutil
|
- bufferutil
|
||||||
- ffmpeg-static
|
|
||||||
- node-opus
|
|
||||||
- opusscript
|
|
||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@types/node/18.8.3:
|
/ansi-styles@4.3.0:
|
||||||
resolution: {integrity: sha512-0os9vz6BpGwxGe9LOhgP/ncvYN5Tx1fNcd2TM3rD/aCGBkysb+ZWpXEocG24h6ZzOi13+VB8HndAQFezsSOw1w==}
|
|
||||||
dev: false
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@types/ws/8.5.3:
|
|
||||||
resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==}
|
|
||||||
dependencies:
|
|
||||||
'@types/node': 18.8.3
|
|
||||||
dev: false
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/ansi-styles/4.3.0:
|
|
||||||
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
|
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dependencies:
|
dependencies:
|
||||||
color-convert: 2.0.1
|
color-convert: 2.0.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/bindings/1.5.0:
|
/bindings@1.5.0:
|
||||||
resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==}
|
resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
file-uri-to-path: 1.0.0
|
file-uri-to-path: 1.0.0
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/busboy/1.6.0:
|
/chalk@4.1.2:
|
||||||
resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==}
|
|
||||||
engines: {node: '>=10.16.0'}
|
|
||||||
dependencies:
|
|
||||||
streamsearch: 1.1.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/chalk/4.1.2:
|
|
||||||
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
|
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -73,23 +68,18 @@ packages:
|
||||||
supports-color: 7.2.0
|
supports-color: 7.2.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/color-convert/2.0.1:
|
/color-convert@2.0.1:
|
||||||
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
|
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
|
||||||
engines: {node: '>=7.0.0'}
|
engines: {node: '>=7.0.0'}
|
||||||
dependencies:
|
dependencies:
|
||||||
color-name: 1.1.4
|
color-name: 1.1.4
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/color-name/1.1.4:
|
/color-name@1.1.4:
|
||||||
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
|
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/discord-api-types/0.36.3:
|
/discord-rpc@4.0.1:
|
||||||
resolution: {integrity: sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==}
|
|
||||||
dev: false
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/discord-rpc/4.0.1:
|
|
||||||
resolution: {integrity: sha512-HOvHpbq5STRZJjQIBzwoKnQ0jHplbEWFWlPDwXXKm/bILh4nzjcg7mNqll0UY7RsjFoaXA7e/oYb/4lvpda2zA==}
|
resolution: {integrity: sha512-HOvHpbq5STRZJjQIBzwoKnQ0jHplbEWFWlPDwXXKm/bILh4nzjcg7mNqll0UY7RsjFoaXA7e/oYb/4lvpda2zA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
node-fetch: 2.6.7
|
node-fetch: 2.6.7
|
||||||
|
@ -102,22 +92,22 @@ packages:
|
||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/file-uri-to-path/1.0.0:
|
/file-uri-to-path@1.0.0:
|
||||||
resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==}
|
resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==}
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/has-flag/4.0.0:
|
/has-flag@4.0.0:
|
||||||
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/node-addon-api/1.7.2:
|
/node-addon-api@1.7.2:
|
||||||
resolution: {integrity: sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==}
|
resolution: {integrity: sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==}
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/node-fetch/2.6.7:
|
/node-fetch@2.6.7:
|
||||||
resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
|
resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
|
||||||
engines: {node: 4.x || >=6.0.0}
|
engines: {node: 4.x || >=6.0.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
@ -129,82 +119,41 @@ packages:
|
||||||
whatwg-url: 5.0.0
|
whatwg-url: 5.0.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/oceanic.js/1.1.2:
|
/opusscript@0.0.8:
|
||||||
resolution: {integrity: sha512-aABMK2UERHvyiwjWFx5m5ZZY7oPUHmVSOhICadZh/vqyxvGf48p+aqGlRu9bEtN6XZYPZJecQi/9IPN+phXn1Q==}
|
resolution: {integrity: sha512-VSTi1aWFuCkRCVq+tx/BQ5q9fMnQ9pVZ3JU4UHKqTkf0ED3fKEPdr+gKAAl3IA2hj9rrP6iyq3hlcJq3HELtNQ==}
|
||||||
engines: {node: '>=16.16.0'}
|
requiresBuild: true
|
||||||
dependencies:
|
|
||||||
undici: 5.11.0
|
|
||||||
ws: 8.9.0
|
|
||||||
optionalDependencies:
|
|
||||||
'@discordjs/voice': 0.11.0
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- '@discordjs/opus'
|
|
||||||
- bufferutil
|
|
||||||
- ffmpeg-static
|
|
||||||
- node-opus
|
|
||||||
- opusscript
|
|
||||||
- utf-8-validate
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/prism-media/1.3.4:
|
|
||||||
resolution: {integrity: sha512-eW7LXORkTCQznZs+eqe9VjGOrLBxcBPXgNyHXMTSRVhphvd/RrxgIR7WaWt4fkLuhshcdT5KHL88LAfcvS3f5g==}
|
|
||||||
peerDependencies:
|
|
||||||
'@discordjs/opus': ^0.8.0
|
|
||||||
ffmpeg-static: ^5.0.2 || ^4.2.7 || ^3.0.0 || ^2.4.0
|
|
||||||
node-opus: ^0.3.3
|
|
||||||
opusscript: ^0.0.8
|
|
||||||
peerDependenciesMeta:
|
|
||||||
'@discordjs/opus':
|
|
||||||
optional: true
|
|
||||||
ffmpeg-static:
|
|
||||||
optional: true
|
|
||||||
node-opus:
|
|
||||||
optional: true
|
|
||||||
opusscript:
|
|
||||||
optional: true
|
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/streamsearch/1.1.0:
|
/supports-color@7.2.0:
|
||||||
resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==}
|
|
||||||
engines: {node: '>=10.0.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/supports-color/7.2.0:
|
|
||||||
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
|
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dependencies:
|
dependencies:
|
||||||
has-flag: 4.0.0
|
has-flag: 4.0.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/tr46/0.0.3:
|
/tr46@0.0.3:
|
||||||
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/tslib/2.4.0:
|
/tweetnacl@1.0.3:
|
||||||
resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==}
|
resolution: {integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==}
|
||||||
|
requiresBuild: true
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/undici/5.11.0:
|
/webidl-conversions@3.0.1:
|
||||||
resolution: {integrity: sha512-oWjWJHzFet0Ow4YZBkyiJwiK5vWqEYoH7BINzJAJOLedZ++JpAlCbUktW2GQ2DS2FpKmxD/JMtWUUWl1BtghGw==}
|
|
||||||
engines: {node: '>=12.18'}
|
|
||||||
dependencies:
|
|
||||||
busboy: 1.6.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/webidl-conversions/3.0.1:
|
|
||||||
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
|
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/whatwg-url/5.0.0:
|
/whatwg-url@5.0.0:
|
||||||
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
|
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
tr46: 0.0.3
|
tr46: 0.0.3
|
||||||
webidl-conversions: 3.0.1
|
webidl-conversions: 3.0.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/ws/7.5.9:
|
/ws@7.5.9:
|
||||||
resolution: {integrity: sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==}
|
resolution: {integrity: sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==}
|
||||||
engines: {node: '>=8.3.0'}
|
engines: {node: '>=8.3.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
@ -217,12 +166,12 @@ packages:
|
||||||
optional: true
|
optional: true
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/ws/8.9.0:
|
/ws@8.13.0:
|
||||||
resolution: {integrity: sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==}
|
resolution: {integrity: sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==}
|
||||||
engines: {node: '>=10.0.0'}
|
engines: {node: '>=10.0.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
bufferutil: ^4.0.1
|
bufferutil: ^4.0.1
|
||||||
utf-8-validate: ^5.0.2
|
utf-8-validate: '>=5.0.2'
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
bufferutil:
|
bufferutil:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
|
@ -4,13 +4,13 @@ const {updatePresence} = require("../lib/presence");
|
||||||
addCommand("A", "toggles AFK mode", function () {
|
addCommand("A", "toggles AFK mode", function () {
|
||||||
if (comcord.state.afk == true) {
|
if (comcord.state.afk == true) {
|
||||||
comcord.state.afk = false;
|
comcord.state.afk = false;
|
||||||
comcord.client.shards.forEach((shard) => (shard.presence.afk = false));
|
|
||||||
comcord.client.editStatus("online");
|
comcord.client.editStatus("online");
|
||||||
|
comcord.client.editAFK(false);
|
||||||
console.log("<you have returned>");
|
console.log("<you have returned>");
|
||||||
} else {
|
} else {
|
||||||
comcord.state.afk = true;
|
comcord.state.afk = true;
|
||||||
comcord.client.shards.forEach((shard) => (shard.presence.afk = true));
|
|
||||||
comcord.client.editStatus("idle");
|
comcord.client.editStatus("idle");
|
||||||
|
comcord.client.editAFK(true);
|
||||||
console.log("<you go AFK>");
|
console.log("<you go AFK>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,12 @@ addCommand("e", "emote", function () {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
process.stdout.write("\n");
|
process.stdout.write("\n");
|
||||||
await comcord.client.guilds
|
await comcord.client.createMessage(comcord.state.currentChannel, {
|
||||||
.get(comcord.state.currentGuild)
|
content: `*${input}*`,
|
||||||
.channels.get(comcord.state.currentChannel)
|
});
|
||||||
.createMessage({content: `*${input}*`});
|
|
||||||
console.log(`<${comcord.client.user.username} ${input}>`);
|
console.log(`<${comcord.client.user.username} ${input}>`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("<failed to send message: " + err.message + ">");
|
console.log(`<failed to send message: ${err.message}>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,10 +8,10 @@ async function getHistory(limit = 20) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const messages = await comcord.client.guilds
|
const messages = await comcord.client.getMessages(
|
||||||
.get(comcord.state.currentGuild)
|
comcord.state.currentChannel,
|
||||||
.channels.get(comcord.state.currentChannel)
|
{limit}
|
||||||
.getMessages({limit});
|
);
|
||||||
messages.reverse();
|
messages.reverse();
|
||||||
|
|
||||||
console.log("--Beginning-Review".padEnd(72, "-"));
|
console.log("--Beginning-Review".padEnd(72, "-"));
|
||||||
|
@ -33,7 +33,7 @@ async function getExtendedHistory(input) {
|
||||||
try {
|
try {
|
||||||
await getHistory(input);
|
await getHistory(input);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("<failed to get history: " + err.message + ">");
|
console.log(`<failed to get history: ${err.message}>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,14 @@ function listChannels() {
|
||||||
|
|
||||||
let longest = 0;
|
let longest = 0;
|
||||||
const guild = comcord.client.guilds.get(comcord.state.currentGuild);
|
const guild = comcord.client.guilds.get(comcord.state.currentGuild);
|
||||||
const channels = [...guild.channels.values()].filter((c) => c.type == 0);
|
const channels = Array.from(guild.channels.values()).filter(
|
||||||
|
(c) => c.type == 0 || c.type == 5
|
||||||
|
);
|
||||||
channels.sort((a, b) => a.position - b.position);
|
channels.sort((a, b) => a.position - b.position);
|
||||||
|
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
const perms = channel.permissionsOf(comcord.client.user.id);
|
const perms = channel.permissionsOf(comcord.client.user.id);
|
||||||
const private = !perms.has("VIEW_CHANNEL");
|
const private = !perms.has("readMessageHistory");
|
||||||
|
|
||||||
if (channel.name.length + (private ? 1 : 0) > longest)
|
if (channel.name.length + (private ? 1 : 0) > longest)
|
||||||
longest = Math.min(25, channel.name.length + (private ? 1 : 0));
|
longest = Math.min(25, channel.name.length + (private ? 1 : 0));
|
||||||
|
@ -26,7 +28,7 @@ function listChannels() {
|
||||||
const topic =
|
const topic =
|
||||||
channel.topic != null ? channel.topic.replace(/\n/g, " ") : "";
|
channel.topic != null ? channel.topic.replace(/\n/g, " ") : "";
|
||||||
const perms = channel.permissionsOf(comcord.client.user.id);
|
const perms = channel.permissionsOf(comcord.client.user.id);
|
||||||
const private = !perms.has("VIEW_CHANNEL");
|
const private = !perms.has("viewChannel");
|
||||||
|
|
||||||
const name = (private ? "*" : "") + channel.name;
|
const name = (private ? "*" : "") + channel.name;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,9 @@ function listGuilds() {
|
||||||
for (const guild of comcord.client.guilds.values()) {
|
for (const guild of comcord.client.guilds.values()) {
|
||||||
if (guild.name.length > longest) longest = guild.name.length;
|
if (guild.name.length > longest) longest = guild.name.length;
|
||||||
|
|
||||||
const online = [...guild.members.values()].filter((m) => m.presence).length;
|
const online = Array.from(guild.members.values()).filter(
|
||||||
|
(m) => m.status
|
||||||
|
).length;
|
||||||
guilds.push({name: guild.name, members: guild.memberCount, online});
|
guilds.push({name: guild.name, members: guild.memberCount, online});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,13 @@ function listUsers() {
|
||||||
`\n[you are in '${guild.name}' in '${channel.name}' among ${guild.memberCount}]\n`
|
`\n[you are in '${guild.name}' in '${channel.name}' among ${guild.memberCount}]\n`
|
||||||
);
|
);
|
||||||
|
|
||||||
const online = [...guild.members.values()].filter((m) => m.presence);
|
const online = Array.from(guild.members.values()).filter((m) => m.status);
|
||||||
online.sort((a, b) => a.tag.localeCompare(b.tag));
|
online.sort((a, b) => a.username.localeCompare(b.username));
|
||||||
|
|
||||||
let longest = 0;
|
let longest = 0;
|
||||||
for (const member of online) {
|
for (const member of online) {
|
||||||
const name = member.tag;
|
// FIXME: remove discrim stuff after username migration finished
|
||||||
|
const name = member.username;
|
||||||
if (name.length + 3 > longest) longest = name.length + 3;
|
if (name.length + 3 > longest) longest = name.length + 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +53,8 @@ function listUsers() {
|
||||||
|
|
||||||
let index = 0;
|
let index = 0;
|
||||||
for (const member of online) {
|
for (const member of online) {
|
||||||
const name = member.tag;
|
const name = member.username;
|
||||||
const status = getStatus(member.presence.status);
|
const status = getStatus(member.status);
|
||||||
const nameAndStatus =
|
const nameAndStatus =
|
||||||
(member.user.bot ? chalk.yellow(name) : chalk.reset(name)) + status;
|
(member.user.bot ? chalk.yellow(name) : chalk.reset(name)) + status;
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,14 @@ const {listUsers} = require("./listUsers");
|
||||||
function startDM(user) {
|
function startDM(user) {
|
||||||
startPrompt(":msg> ", async function (input) {
|
startPrompt(":msg> ", async function (input) {
|
||||||
if (input == "") {
|
if (input == "") {
|
||||||
console.log(`\n<message not sent to ${user.tag}>`);
|
console.log(`\n<message not sent to ${user.username}>`);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
const channel = await user.createDM();
|
const channel = await comcord.client.getDMChannel(user.id);
|
||||||
await channel.createMessage({content: input});
|
await channel.createMessage({content: input});
|
||||||
console.log(chalk.bold.green(`\n<message sent to ${user.tag}>`));
|
console.log(chalk.bold.green(`\n<message sent to ${user.username}>`));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("\n<failed to send message: " + err.message + ">");
|
console.log(`\n<failed to send message: ${err.message}>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -25,7 +25,7 @@ addCommand("s", "send private", function () {
|
||||||
startPrompt(":to> ", function (who) {
|
startPrompt(":to> ", function (who) {
|
||||||
let target;
|
let target;
|
||||||
for (const user of comcord.client.users.values()) {
|
for (const user of comcord.client.users.values()) {
|
||||||
if (user.tag == who) {
|
if (user.username == who) {
|
||||||
target = user;
|
target = user;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,9 @@ addCommand("s", "send private", function () {
|
||||||
|
|
||||||
addCommand("a", "answer a send", function () {
|
addCommand("a", "answer a send", function () {
|
||||||
if (comcord.state.lastDM) {
|
if (comcord.state.lastDM) {
|
||||||
console.log(chalk.bold.green(`<answering ${comcord.state.lastDM.tag}>`));
|
console.log(
|
||||||
|
chalk.bold.green(`<answering ${comcord.state.lastDM.username}>`)
|
||||||
|
);
|
||||||
startDM(comcord.state.lastDM);
|
startDM(comcord.state.lastDM);
|
||||||
} else {
|
} else {
|
||||||
// FIXME: figure out the actual message in com
|
// FIXME: figure out the actual message in com
|
||||||
|
|
|
@ -21,10 +21,9 @@ function sendMode() {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
process.stdout.write("\n");
|
process.stdout.write("\n");
|
||||||
await comcord.client.guilds
|
await comcord.client.createMessage(comcord.state.currentChannel, {
|
||||||
.get(comcord.state.currentGuild)
|
content: input,
|
||||||
.channels.get(comcord.state.currentChannel)
|
});
|
||||||
.createMessage({content: input});
|
|
||||||
|
|
||||||
if (comcord.state.afk == true) {
|
if (comcord.state.afk == true) {
|
||||||
comcord.state.afk = false;
|
comcord.state.afk = false;
|
||||||
|
|
94
src/index.js
94
src/index.js
|
@ -1,13 +1,14 @@
|
||||||
const {Client, Constants} = require("oceanic.js");
|
const {Client, Constants, Channel} = require("@projectdysnomia/dysnomia");
|
||||||
const DiscordRPC = require("discord-rpc");
|
const DiscordRPC = require("discord-rpc");
|
||||||
const chalk = require("chalk");
|
const chalk = require("chalk");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
const os = require("os");
|
||||||
|
|
||||||
const rcfile = require("./lib/rcfile");
|
const rcfile = require("./lib/rcfile");
|
||||||
const config = {};
|
const config = {};
|
||||||
|
|
||||||
if (fs.existsSync(rcfile.path)) {
|
if (fs.existsSync(rcfile.path)) {
|
||||||
console.log("% Reading " + rcfile.path + " ...");
|
console.log(`% Reading ${rcfile.path.replace(os.homedir(), "~")} ...`);
|
||||||
rcfile.readFile(config);
|
rcfile.readFile(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,31 +43,19 @@ global.comcord = {
|
||||||
},
|
},
|
||||||
commands: {},
|
commands: {},
|
||||||
};
|
};
|
||||||
const client = new Client({
|
const client = new Client(
|
||||||
auth:
|
(config.allowUserAccounts == "true" ? "" : "Bot ") + (token ?? config.token),
|
||||||
(config.allowUserAccounts == "true" ? "" : "Bot ") +
|
{
|
||||||
(token ?? config.token),
|
|
||||||
defaultImageFormat: "png",
|
defaultImageFormat: "png",
|
||||||
defaultImageSize: 1024,
|
defaultImageSize: 1024,
|
||||||
gateway: {
|
gateway: {
|
||||||
intents: ["ALL"],
|
intents: Object.values(Constants.Intents),
|
||||||
maxShards: 1,
|
|
||||||
concurrency: 1,
|
|
||||||
presence: {
|
|
||||||
status: "online",
|
|
||||||
activities: [
|
|
||||||
{
|
|
||||||
name: "comcord",
|
|
||||||
type: 0,
|
|
||||||
application_id: CLIENT_ID,
|
|
||||||
timestamps: {
|
|
||||||
start: comcord.state.startTime,
|
|
||||||
},
|
},
|
||||||
|
allowedMentions: {
|
||||||
|
everyone: false,
|
||||||
},
|
},
|
||||||
],
|
}
|
||||||
},
|
);
|
||||||
},
|
|
||||||
});
|
|
||||||
comcord.client = client;
|
comcord.client = client;
|
||||||
const rpc = new DiscordRPC.Client({transport: "ipc"});
|
const rpc = new DiscordRPC.Client({transport: "ipc"});
|
||||||
comcord.rpc = rpc;
|
comcord.rpc = rpc;
|
||||||
|
@ -93,7 +82,8 @@ process.stdin.setEncoding("utf8");
|
||||||
|
|
||||||
client.once("ready", function () {
|
client.once("ready", function () {
|
||||||
console.log(
|
console.log(
|
||||||
"Logged in as: " + chalk.yellow(`${client.user.tag} (${client.user.id})`)
|
"Logged in as: " +
|
||||||
|
chalk.yellow(`${client.user.username} (${client.user.id})`)
|
||||||
);
|
);
|
||||||
comcord.state.nameLength = client.user.username.length + 2;
|
comcord.state.nameLength = client.user.username.length + 2;
|
||||||
|
|
||||||
|
@ -135,6 +125,7 @@ rpc.on("connected", function () {
|
||||||
});
|
});
|
||||||
let retryingRPC = false;
|
let retryingRPC = false;
|
||||||
rpc.once("ready", function () {
|
rpc.once("ready", function () {
|
||||||
|
rpc.transport.on("error", function () {});
|
||||||
rpc.transport.on("close", function () {
|
rpc.transport.on("close", function () {
|
||||||
comcord.state.rpcConnected = false;
|
comcord.state.rpcConnected = false;
|
||||||
if (!retryingRPC) {
|
if (!retryingRPC) {
|
||||||
|
@ -158,20 +149,19 @@ rpc.on("error", function () {});
|
||||||
client.on("messageCreate", async function (msg) {
|
client.on("messageCreate", async function (msg) {
|
||||||
if (msg.author.id === client.user.id) return;
|
if (msg.author.id === client.user.id) return;
|
||||||
|
|
||||||
if (msg.channelID && !msg.channel) {
|
if (
|
||||||
try {
|
!(msg.channel instanceof Channel) &&
|
||||||
const dmChannel = await msg.author.createDM();
|
msg.author.id != client.user.id &&
|
||||||
if (dmChannel.id === msg.channelID) {
|
!msg.guildID
|
||||||
msg.channel = dmChannel;
|
) {
|
||||||
}
|
const newChannel = await client.getDMChannel(msg.author.id);
|
||||||
} catch {
|
if (msg.channel.id == newChannel.id) msg.channel = newChannel;
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(msg.channel instanceof Channel)) return;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(msg.channel ? msg.channel.id : msg.channelID) ==
|
msg.channel.id == comcord.state.currentChannel ||
|
||||||
comcord.state.currentChannel ||
|
|
||||||
msg.channel?.recipient != null
|
msg.channel?.recipient != null
|
||||||
) {
|
) {
|
||||||
if (comcord.state.inPrompt) {
|
if (comcord.state.inPrompt) {
|
||||||
|
@ -188,20 +178,19 @@ client.on("messageCreate", async function (msg) {
|
||||||
client.on("messageUpdate", async function (msg, old) {
|
client.on("messageUpdate", async function (msg, old) {
|
||||||
if (msg.author.id === client.user.id) return;
|
if (msg.author.id === client.user.id) return;
|
||||||
|
|
||||||
if (msg.channelID && !msg.channel) {
|
if (
|
||||||
try {
|
!(msg.channel instanceof Channel) &&
|
||||||
const dmChannel = await msg.author.createDM();
|
msg.author.id != client.user.id &&
|
||||||
if (dmChannel.id === msg.channelID) {
|
!msg.guildID
|
||||||
msg.channel = dmChannel;
|
) {
|
||||||
}
|
const newChannel = await client.getDMChannel(msg.author.id);
|
||||||
} catch {
|
if (msg.channel.id == newChannel.id) msg.channel = newChannel;
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(msg.channel instanceof Channel)) return;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(msg.channel ? msg.channel.id : msg.channelID) ==
|
msg.channel.id == comcord.state.currentChannel ||
|
||||||
comcord.state.currentChannel ||
|
|
||||||
msg.channel?.recipient != null
|
msg.channel?.recipient != null
|
||||||
) {
|
) {
|
||||||
if (old && msg.content == old.content) return;
|
if (old && msg.content == old.content) return;
|
||||||
|
@ -253,7 +242,10 @@ if (
|
||||||
config.allowUserAccounts == "true" &&
|
config.allowUserAccounts == "true" &&
|
||||||
!(token ?? config.token).startsWith("Bot ")
|
!(token ?? config.token).startsWith("Bot ")
|
||||||
) {
|
) {
|
||||||
if (fetch == null) {
|
console.log("User account support pending rewrite.");
|
||||||
|
process.exit(1);
|
||||||
|
|
||||||
|
/*if (fetch == null) {
|
||||||
console.log("Node v18+ needed for user account support.");
|
console.log("Node v18+ needed for user account support.");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
@ -270,14 +262,6 @@ if (
|
||||||
const newConnect = new client.connect.constructor(connectLines.join("\n"));
|
const newConnect = new client.connect.constructor(connectLines.join("\n"));
|
||||||
client.connect = newConnect.bind(client);
|
client.connect = newConnect.bind(client);
|
||||||
|
|
||||||
// gross hack
|
|
||||||
global.Constants_1 = Constants;
|
|
||||||
try {
|
|
||||||
global.Erlpack = require("erlpack");
|
|
||||||
} catch {
|
|
||||||
global.Erlpack = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("% Injecting headers into request handler");
|
console.log("% Injecting headers into request handler");
|
||||||
client.rest.handler.options.userAgent = `Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/${superProperties.client_version} Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36`;
|
client.rest.handler.options.userAgent = `Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/${superProperties.client_version} Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36`;
|
||||||
client.rest.handler._request = client.rest.handler.request.bind(
|
client.rest.handler._request = client.rest.handler.request.bind(
|
||||||
|
@ -328,7 +312,7 @@ if (
|
||||||
|
|
||||||
console.log("% Connecting to gateway now");
|
console.log("% Connecting to gateway now");
|
||||||
await client.connect();
|
await client.connect();
|
||||||
})();
|
})();*/
|
||||||
} else {
|
} else {
|
||||||
client.connect();
|
client.connect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,6 @@ function replaceTimestamps(_, time, format = "f") {
|
||||||
|
|
||||||
function formatMessage({
|
function formatMessage({
|
||||||
name,
|
name,
|
||||||
tag,
|
|
||||||
content,
|
content,
|
||||||
bot,
|
bot,
|
||||||
attachments,
|
attachments,
|
||||||
|
@ -252,10 +251,10 @@ function formatMessage({
|
||||||
|
|
||||||
if (dm) {
|
if (dm) {
|
||||||
if (noColor) {
|
if (noColor) {
|
||||||
console.log(`*${tag}* ${content}\x07`);
|
console.log(`*${name}* ${content}\x07`);
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
chalk.bold.red(`*${tag}*`) + chalk.reset(" " + content + "\x07")
|
chalk.bold.red(`*${name}*`) + chalk.reset(" " + content + "\x07")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
|
@ -331,7 +330,6 @@ function processMessage(msg, options = {}) {
|
||||||
if (msg.content.match(REGEX_CODEBLOCK)) {
|
if (msg.content.match(REGEX_CODEBLOCK)) {
|
||||||
formatMessage({
|
formatMessage({
|
||||||
name: msg.author.username,
|
name: msg.author.username,
|
||||||
tag: msg.author.tag,
|
|
||||||
bot: msg.author.bot,
|
bot: msg.author.bot,
|
||||||
content: msg.content.replace(
|
content: msg.content.replace(
|
||||||
REGEX_CODEBLOCK_GLOBAL,
|
REGEX_CODEBLOCK_GLOBAL,
|
||||||
|
@ -349,7 +347,6 @@ function processMessage(msg, options = {}) {
|
||||||
const line = lines[index];
|
const line = lines[index];
|
||||||
formatMessage({
|
formatMessage({
|
||||||
name: msg.author.username,
|
name: msg.author.username,
|
||||||
tag: msg.author.tag,
|
|
||||||
bot: msg.author.bot,
|
bot: msg.author.bot,
|
||||||
content:
|
content:
|
||||||
line +
|
line +
|
||||||
|
@ -366,7 +363,6 @@ function processMessage(msg, options = {}) {
|
||||||
} else {
|
} else {
|
||||||
formatMessage({
|
formatMessage({
|
||||||
name: msg.author.username,
|
name: msg.author.username,
|
||||||
tag: msg.author.tag,
|
|
||||||
bot: msg.author.bot,
|
bot: msg.author.bot,
|
||||||
content: msg.content + (msg.editedTimestamp != null ? " (edited)" : ""),
|
content: msg.content + (msg.editedTimestamp != null ? " (edited)" : ""),
|
||||||
attachments: msg.attachments,
|
attachments: msg.attachments,
|
||||||
|
|
|
@ -15,7 +15,7 @@ function updatePresence() {
|
||||||
const activity = {
|
const activity = {
|
||||||
startTimestamp: comcord.state.startTime,
|
startTimestamp: comcord.state.startTime,
|
||||||
smallImageKey: `https://cdn.discordapp.com/avatars/${comcord.client.user.id}/${comcord.client.user.avatar}.png?size=1024`,
|
smallImageKey: `https://cdn.discordapp.com/avatars/${comcord.client.user.id}/${comcord.client.user.avatar}.png?size=1024`,
|
||||||
smallImageText: comcord.client.user.tag,
|
smallImageText: comcord.client.user.username,
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
label: "comcord Repo",
|
label: "comcord Repo",
|
||||||
|
@ -39,6 +39,17 @@ function updatePresence() {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
comcord.client.editStatus(comcord.state.afk ? "idle" : "online", [
|
||||||
|
{
|
||||||
|
name: "comcord",
|
||||||
|
type: 0,
|
||||||
|
application_id: CLIENT_ID,
|
||||||
|
timestamps: {
|
||||||
|
start: comcord.state.startTime,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
} else {
|
} else {
|
||||||
const activity = {
|
const activity = {
|
||||||
application_id: CLIENT_ID,
|
application_id: CLIENT_ID,
|
||||||
|
@ -65,12 +76,9 @@ function updatePresence() {
|
||||||
activity.state = "AFK";
|
activity.state = "AFK";
|
||||||
}
|
}
|
||||||
|
|
||||||
comcord.client.shards.forEach((shard) => {
|
comcord.client.editStatus(comcord.state.afk ? "idle" : "online", [
|
||||||
if (shard.ready) {
|
activity,
|
||||||
shard.presence.activities = [activity];
|
]);
|
||||||
shard.sendPresenceUpdate();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue