feat(api): show guilds that the bot isn't in

This commit is contained in:
Isaac 2023-03-10 00:24:33 +00:00
parent 25d7cdaee8
commit ea9d3e4e33
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33
6 changed files with 82 additions and 74 deletions

View File

@ -40,7 +40,7 @@
"node": ">=18" "node": ">=18"
}, },
"dependencies": { "dependencies": {
"@discord-tickets/settings": "^1.4.2", "@discord-tickets/settings": "^1.5.0",
"@eartharoid/dbf": "^0.3.3", "@eartharoid/dbf": "^0.3.3",
"@eartharoid/dtf": "^2.0.1", "@eartharoid/dtf": "^2.0.1",
"@eartharoid/i18n": "^1.2.1", "@eartharoid/i18n": "^1.2.1",
@ -51,11 +51,11 @@
"@fastify/oauth2": "^5.1.0", "@fastify/oauth2": "^5.1.0",
"@prisma/client": "^4.11.0", "@prisma/client": "^4.11.0",
"boxen": "^7.0.2", "boxen": "^7.0.2",
"cryptr": "^6.1.0", "cryptr": "^6.2.0",
"discord.js": "^14.7.1", "discord.js": "^14.7.1",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"express": "^4.18.2", "express": "^4.18.2",
"fastify": "^4.13.0", "fastify": "^4.14.1",
"figlet": "^1.5.2", "figlet": "^1.5.2",
"fs-extra": "^10.1.0", "fs-extra": "^10.1.0",
"keyv": "^4.5.2", "keyv": "^4.5.2",
@ -76,11 +76,11 @@
"@commitlint/config-conventional": "^17.4.4", "@commitlint/config-conventional": "^17.4.4",
"all-contributors-cli": "^6.24.0", "all-contributors-cli": "^6.24.0",
"conventional-changelog-cli": "^2.2.2", "conventional-changelog-cli": "^2.2.2",
"eslint": "^8.34.0", "eslint": "^8.35.0",
"eslint-plugin-unused-imports": "^2.0.0", "eslint-plugin-unused-imports": "^2.0.0",
"husky": "^8.0.3", "husky": "^8.0.3",
"lint-staged": "^13.1.2", "lint-staged": "^13.1.2",
"nodemon": "^2.0.20" "nodemon": "^2.0.21"
}, },
"optionalDependencies": { "optionalDependencies": {
"bufferutil": "^4.0.7", "bufferutil": "^4.0.7",

View File

@ -3,7 +3,7 @@ lockfileVersion: 5.4
specifiers: specifiers:
'@commitlint/cli': ^17.4.4 '@commitlint/cli': ^17.4.4
'@commitlint/config-conventional': ^17.4.4 '@commitlint/config-conventional': ^17.4.4
'@discord-tickets/settings': ^1.4.2 '@discord-tickets/settings': ^1.5.0
'@eartharoid/dbf': ^0.3.3 '@eartharoid/dbf': ^0.3.3
'@eartharoid/dtf': ^2.0.1 '@eartharoid/dtf': ^2.0.1
'@eartharoid/i18n': ^1.2.1 '@eartharoid/i18n': ^1.2.1
@ -17,14 +17,14 @@ specifiers:
boxen: ^7.0.2 boxen: ^7.0.2
bufferutil: ^4.0.7 bufferutil: ^4.0.7
conventional-changelog-cli: ^2.2.2 conventional-changelog-cli: ^2.2.2
cryptr: ^6.1.0 cryptr: ^6.2.0
discord.js: ^14.7.1 discord.js: ^14.7.1
dotenv: ^16.0.3 dotenv: ^16.0.3
erlpack: github:discord/erlpack erlpack: github:discord/erlpack
eslint: ^8.34.0 eslint: ^8.35.0
eslint-plugin-unused-imports: ^2.0.0 eslint-plugin-unused-imports: ^2.0.0
express: ^4.18.2 express: ^4.18.2
fastify: ^4.13.0 fastify: ^4.14.1
figlet: ^1.5.2 figlet: ^1.5.2
fs-extra: ^10.1.0 fs-extra: ^10.1.0
husky: ^8.0.3 husky: ^8.0.3
@ -36,7 +36,7 @@ specifiers:
mustache: ^4.2.0 mustache: ^4.2.0
node-dir: ^0.1.17 node-dir: ^0.1.17
node-emoji: ^1.11.0 node-emoji: ^1.11.0
nodemon: ^2.0.20 nodemon: ^2.0.21
object-diffy: ^1.0.4 object-diffy: ^1.0.4
prisma: ^4.11.0 prisma: ^4.11.0
semver: ^7.3.8 semver: ^7.3.8
@ -46,7 +46,7 @@ specifiers:
zlib-sync: ^0.1.8 zlib-sync: ^0.1.8
dependencies: dependencies:
'@discord-tickets/settings': 1.4.2_svelte@3.55.1 '@discord-tickets/settings': 1.5.0_svelte@3.55.1
'@eartharoid/dbf': 0.3.3_3cxu5zja4e2r5wmvge7mdcljwq '@eartharoid/dbf': 0.3.3_3cxu5zja4e2r5wmvge7mdcljwq
'@eartharoid/dtf': 2.0.1 '@eartharoid/dtf': 2.0.1
'@eartharoid/i18n': 1.2.1 '@eartharoid/i18n': 1.2.1
@ -57,11 +57,11 @@ dependencies:
'@fastify/oauth2': 5.1.0 '@fastify/oauth2': 5.1.0
'@prisma/client': 4.11.0_prisma@4.11.0 '@prisma/client': 4.11.0_prisma@4.11.0
boxen: 7.0.2 boxen: 7.0.2
cryptr: 6.1.0 cryptr: 6.2.0
discord.js: 14.7.1_3cxu5zja4e2r5wmvge7mdcljwq discord.js: 14.7.1_3cxu5zja4e2r5wmvge7mdcljwq
dotenv: 16.0.3 dotenv: 16.0.3
express: 4.18.2 express: 4.18.2
fastify: 4.13.0 fastify: 4.14.1
figlet: 1.5.2 figlet: 1.5.2
fs-extra: 10.1.0 fs-extra: 10.1.0
keyv: 4.5.2 keyv: 4.5.2
@ -88,11 +88,11 @@ devDependencies:
'@commitlint/config-conventional': 17.4.4 '@commitlint/config-conventional': 17.4.4
all-contributors-cli: 6.24.0 all-contributors-cli: 6.24.0
conventional-changelog-cli: 2.2.2 conventional-changelog-cli: 2.2.2
eslint: 8.34.0 eslint: 8.35.0
eslint-plugin-unused-imports: 2.0.0_eslint@8.34.0 eslint-plugin-unused-imports: 2.0.0_eslint@8.35.0
husky: 8.0.3 husky: 8.0.3
lint-staged: 13.1.2 lint-staged: 13.1.2
nodemon: 2.0.20 nodemon: 2.0.21
packages: packages:
@ -210,15 +210,15 @@ packages:
'@commitlint/execute-rule': 17.4.0 '@commitlint/execute-rule': 17.4.0
'@commitlint/resolve-extends': 17.4.4 '@commitlint/resolve-extends': 17.4.4
'@commitlint/types': 17.4.4 '@commitlint/types': 17.4.4
'@types/node': 18.14.1 '@types/node': 18.15.0
chalk: 4.1.2 chalk: 4.1.2
cosmiconfig: 8.0.0 cosmiconfig: 8.1.0
cosmiconfig-typescript-loader: 4.3.0_s4dpre5ezutgdzsn47klmddvia cosmiconfig-typescript-loader: 4.3.0_lmcvhluzh3a7wwwkanu7ndhele
lodash.isplainobject: 4.0.6 lodash.isplainobject: 4.0.6
lodash.merge: 4.6.2 lodash.merge: 4.6.2
lodash.uniq: 4.5.0 lodash.uniq: 4.5.0
resolve-from: 5.0.0 resolve-from: 5.0.0
ts-node: 10.9.1_uayvamxqnl5yeiojjysxwopmsy ts-node: 10.9.1_lwgqdwokjtwlohdqtbb6s252kq
typescript: 4.9.5 typescript: 4.9.5
transitivePeerDependencies: transitivePeerDependencies:
- '@swc/core' - '@swc/core'
@ -299,8 +299,8 @@ packages:
'@jridgewell/trace-mapping': 0.3.9 '@jridgewell/trace-mapping': 0.3.9
dev: true dev: true
/@discord-tickets/settings/1.4.2_svelte@3.55.1: /@discord-tickets/settings/1.5.0_svelte@3.55.1:
resolution: {integrity: sha512-C8/aS9XTDUcnaX8wbFFUxH32M9SELcZ/BbsARTnXwFS3fGFs04mMI7L05Br0VHMYbKGmIykBMNZAGGco6Ka48A==} resolution: {integrity: sha512-zsP0FjbrHgs6lpXYRAuuPemqWog385rC27v6Rh0zZd8S60yH8ZQ5u/E8ZIR6Cx8c9OJwStzJ6uEZCfTy69ayGw==}
dependencies: dependencies:
'@fortawesome/fontawesome-free': 6.3.0 '@fortawesome/fontawesome-free': 6.3.0
'@skyra/discord-components-core': 3.6.0 '@skyra/discord-components-core': 3.6.0
@ -373,8 +373,8 @@ packages:
resolution: {integrity: sha512-nMQdHrGgpw+vNL5DbivELW2K3KAUGaMvTjjmFsEPf8mUW8+LAgRjvfFn2gkJq1mnlD6HoqUaHqEL4YpWr2T5MA==} resolution: {integrity: sha512-nMQdHrGgpw+vNL5DbivELW2K3KAUGaMvTjjmFsEPf8mUW8+LAgRjvfFn2gkJq1mnlD6HoqUaHqEL4YpWr2T5MA==}
dev: false dev: false
/@eslint/eslintrc/1.4.1: /@eslint/eslintrc/2.0.0:
resolution: {integrity: sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==} resolution: {integrity: sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies: dependencies:
ajv: 6.12.6 ajv: 6.12.6
@ -390,6 +390,11 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@eslint/js/8.35.0:
resolution: {integrity: sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
/@fastify/ajv-compiler/3.5.0: /@fastify/ajv-compiler/3.5.0:
resolution: {integrity: sha512-ebbEtlI7dxXF5ziNdr05mOY8NnDiPB1XvAlLHctRt/Rc+C3LCOVW5imUVX+mhvUhnNzmPBHewUkOFgGlCxgdAA==} resolution: {integrity: sha512-ebbEtlI7dxXF5ziNdr05mOY8NnDiPB1XvAlLHctRt/Rc+C3LCOVW5imUVX+mhvUhnNzmPBHewUkOFgGlCxgdAA==}
dependencies: dependencies:
@ -401,7 +406,7 @@ packages:
/@fastify/cookie/6.0.0: /@fastify/cookie/6.0.0:
resolution: {integrity: sha512-Luy3Po3dOJmqAuPCiPcWsX0tV5+C3AOnULSdlsGjNGOvyE7jqzysp8kT9ICfsUvove+TeUMgTWl1y9XS3ZPPMg==} resolution: {integrity: sha512-Luy3Po3dOJmqAuPCiPcWsX0tV5+C3AOnULSdlsGjNGOvyE7jqzysp8kT9ICfsUvove+TeUMgTWl1y9XS3ZPPMg==}
dependencies: dependencies:
cookie-signature: 1.2.0 cookie-signature: 1.2.1
fastify-plugin: 3.0.1 fastify-plugin: 3.0.1
dev: false dev: false
@ -680,8 +685,8 @@ packages:
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
dev: true dev: true
/@types/node/18.14.1: /@types/node/18.15.0:
resolution: {integrity: sha512-QH+37Qds3E0eDlReeboBxfHbX9omAcBCXEzswCu6jySP642jiM3cYSIkU/REqwhCUqXdonHFuBfJDiAJxMNhaQ==} resolution: {integrity: sha512-z6nr0TTEOBGkzLGmbypWOGnpSpSIBorEhC4L+4HeQ2iezKCi4f77kyslRwvHeNitymGQ+oFyIWGP96l/DPSV9w==}
/@types/normalize-package-data/2.4.1: /@types/normalize-package-data/2.4.1:
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
@ -690,7 +695,7 @@ packages:
/@types/ws/8.5.4: /@types/ws/8.5.4:
resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==} resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==}
dependencies: dependencies:
'@types/node': 18.14.1 '@types/node': 18.15.0
dev: false dev: false
/JSONStream/1.3.5: /JSONStream/1.3.5:
@ -1366,8 +1371,8 @@ packages:
resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==} resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==}
dev: false dev: false
/cookie-signature/1.2.0: /cookie-signature/1.2.1:
resolution: {integrity: sha512-R0BOPfLGTitaKhgKROKZQN6iyq2iDQcH1DOF8nJoaWapguX5bC2w+Q/I9NmmM5lfcvEarnLZr+cCvmEYYSXvYA==} resolution: {integrity: sha512-78KWk9T26NhzXtuL26cIJ8/qNHANyJ/ZYrmEXFzUmhZdjpBv+DlWlOANRTGBt48YcyslsLrj0bMLFTmXvLRCOw==}
engines: {node: '>=6.6.0'} engines: {node: '>=6.6.0'}
dev: false dev: false
@ -1380,7 +1385,7 @@ packages:
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
dev: true dev: true
/cosmiconfig-typescript-loader/4.3.0_s4dpre5ezutgdzsn47klmddvia: /cosmiconfig-typescript-loader/4.3.0_lmcvhluzh3a7wwwkanu7ndhele:
resolution: {integrity: sha512-NTxV1MFfZDLPiBMjxbHRwSh5LaLcPMwNdCutmnHJCKoVnlvldPWlllonKwrsRJ5pYZBIBGRWWU2tfvzxgeSW5Q==} resolution: {integrity: sha512-NTxV1MFfZDLPiBMjxbHRwSh5LaLcPMwNdCutmnHJCKoVnlvldPWlllonKwrsRJ5pYZBIBGRWWU2tfvzxgeSW5Q==}
engines: {node: '>=12', npm: '>=6'} engines: {node: '>=12', npm: '>=6'}
peerDependencies: peerDependencies:
@ -1389,14 +1394,14 @@ packages:
ts-node: '>=10' ts-node: '>=10'
typescript: '>=3' typescript: '>=3'
dependencies: dependencies:
'@types/node': 18.14.1 '@types/node': 18.15.0
cosmiconfig: 8.0.0 cosmiconfig: 8.1.0
ts-node: 10.9.1_uayvamxqnl5yeiojjysxwopmsy ts-node: 10.9.1_lwgqdwokjtwlohdqtbb6s252kq
typescript: 4.9.5 typescript: 4.9.5
dev: true dev: true
/cosmiconfig/8.0.0: /cosmiconfig/8.1.0:
resolution: {integrity: sha512-da1EafcpH6b/TD8vDRaWV7xFINlHlF6zKsGwS1TsuVJTZRkquaS5HTMq7uq6h31619QjbsYl21gVDOm32KM1vQ==} resolution: {integrity: sha512-0tLZ9URlPGU7JsKq0DQOQ3FoRsYX8xDZ7xMiATQfaiGMz7EHowNkbU9u1coAOmnh9p/1ySpm0RB3JNWRXM5GCg==}
engines: {node: '>=14'} engines: {node: '>=14'}
dependencies: dependencies:
import-fresh: 3.3.0 import-fresh: 3.3.0
@ -1418,8 +1423,8 @@ packages:
which: 2.0.2 which: 2.0.2
dev: true dev: true
/cryptr/6.1.0: /cryptr/6.2.0:
resolution: {integrity: sha512-vJBrDcKAZ/OpMW4EptbGTD2EfNEywh6QtsPDX5kd2u1MNBmTLGC3IlOoRh8Ov7dmZhFfRjUJ07u4eCoJ8+oM9A==} resolution: {integrity: sha512-jYi8SxvOFebTT7EYOABiPpHKY6lwWaP9IVcvT/aIVJUVoFdzTgi0ySPCL78q1ig8w2kwfXFCZACXoCXaye57aw==}
dev: false dev: false
/dargs/7.0.0: /dargs/7.0.0:
@ -1617,7 +1622,7 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/eslint-plugin-unused-imports/2.0.0_eslint@8.34.0: /eslint-plugin-unused-imports/2.0.0_eslint@8.35.0:
resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==} resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -1627,7 +1632,7 @@ packages:
'@typescript-eslint/eslint-plugin': '@typescript-eslint/eslint-plugin':
optional: true optional: true
dependencies: dependencies:
eslint: 8.34.0 eslint: 8.35.0
eslint-rule-composer: 0.3.0 eslint-rule-composer: 0.3.0
dev: true dev: true
@ -1644,13 +1649,13 @@ packages:
estraverse: 5.3.0 estraverse: 5.3.0
dev: true dev: true
/eslint-utils/3.0.0_eslint@8.34.0: /eslint-utils/3.0.0_eslint@8.35.0:
resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==}
engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0}
peerDependencies: peerDependencies:
eslint: '>=5' eslint: '>=5'
dependencies: dependencies:
eslint: 8.34.0 eslint: 8.35.0
eslint-visitor-keys: 2.1.0 eslint-visitor-keys: 2.1.0
dev: true dev: true
@ -1664,12 +1669,13 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true dev: true
/eslint/8.34.0: /eslint/8.35.0:
resolution: {integrity: sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==} resolution: {integrity: sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
hasBin: true hasBin: true
dependencies: dependencies:
'@eslint/eslintrc': 1.4.1 '@eslint/eslintrc': 2.0.0
'@eslint/js': 8.35.0
'@humanwhocodes/config-array': 0.11.8 '@humanwhocodes/config-array': 0.11.8
'@humanwhocodes/module-importer': 1.0.1 '@humanwhocodes/module-importer': 1.0.1
'@nodelib/fs.walk': 1.2.8 '@nodelib/fs.walk': 1.2.8
@ -1680,10 +1686,10 @@ packages:
doctrine: 3.0.0 doctrine: 3.0.0
escape-string-regexp: 4.0.0 escape-string-regexp: 4.0.0
eslint-scope: 7.1.1 eslint-scope: 7.1.1
eslint-utils: 3.0.0_eslint@8.34.0 eslint-utils: 3.0.0_eslint@8.35.0
eslint-visitor-keys: 3.3.0 eslint-visitor-keys: 3.3.0
espree: 9.4.1 espree: 9.4.1
esquery: 1.4.2 esquery: 1.5.0
esutils: 2.0.3 esutils: 2.0.3
fast-deep-equal: 3.1.3 fast-deep-equal: 3.1.3
file-entry-cache: 6.0.1 file-entry-cache: 6.0.1
@ -1721,8 +1727,8 @@ packages:
eslint-visitor-keys: 3.3.0 eslint-visitor-keys: 3.3.0
dev: true dev: true
/esquery/1.4.2: /esquery/1.5.0:
resolution: {integrity: sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==} resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==}
engines: {node: '>=0.10'} engines: {node: '>=0.10'}
dependencies: dependencies:
estraverse: 5.3.0 estraverse: 5.3.0
@ -1907,8 +1913,8 @@ packages:
resolution: {integrity: sha512-79ak0JxddO0utAXAQ5ccKhvs6vX2MGyHHMMsmZkBANrq3hXc1CHzvNPHOcvTsVMEPl5I+NT+RO4YKMGehOfSIg==} resolution: {integrity: sha512-79ak0JxddO0utAXAQ5ccKhvs6vX2MGyHHMMsmZkBANrq3hXc1CHzvNPHOcvTsVMEPl5I+NT+RO4YKMGehOfSIg==}
dev: false dev: false
/fastify/4.13.0: /fastify/4.14.1:
resolution: {integrity: sha512-p9ibdFWH3pZ7KPgmfHPKGUy2W4EWU2TEpwlcu58w4CwGyU3ARFfh2kwq6zpZ5W2ZGVbufi4tZbqHIHAlX/9Z/A==} resolution: {integrity: sha512-yjrDeXe77j9gRlSV2UJry8mcFWbD0NQ5JYjnPi4tkFjHZVaG3/BD5wxOmRzGnHPC0YvaBJ0XWrIfFPl2IHRa1w==}
dependencies: dependencies:
'@fastify/ajv-compiler': 3.5.0 '@fastify/ajv-compiler': 3.5.0
'@fastify/error': 3.2.0 '@fastify/error': 3.2.0
@ -2902,8 +2908,8 @@ packages:
hasBin: true hasBin: true
dev: false dev: false
/nodemon/2.0.20: /nodemon/2.0.21:
resolution: {integrity: sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==} resolution: {integrity: sha512-djN/n2549DUtY33S7o1djRCd7dEm0kBnj9c7S9XVXqRUbuggN1MZH/Nqa+5RFQr63Fbefq37nFXAE9VU86yL1A==}
engines: {node: '>=8.10.0'} engines: {node: '>=8.10.0'}
hasBin: true hasBin: true
requiresBuild: true requiresBuild: true
@ -3699,8 +3705,8 @@ packages:
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
dev: true dev: true
/spdx-correct/3.1.1: /spdx-correct/3.2.0:
resolution: {integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==} resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==}
dependencies: dependencies:
spdx-expression-parse: 3.0.1 spdx-expression-parse: 3.0.1
spdx-license-ids: 3.0.12 spdx-license-ids: 3.0.12
@ -3981,7 +3987,7 @@ packages:
resolution: {integrity: sha512-k43M7uCG1AkTyxgnmI5MPwKoUvS/bRvLvUb7+Pgpdlmok8AoqmUaZxUUw8zKM5B1lqZrt41GjYgnvAi0fppqgQ==} resolution: {integrity: sha512-k43M7uCG1AkTyxgnmI5MPwKoUvS/bRvLvUb7+Pgpdlmok8AoqmUaZxUUw8zKM5B1lqZrt41GjYgnvAi0fppqgQ==}
dev: false dev: false
/ts-node/10.9.1_uayvamxqnl5yeiojjysxwopmsy: /ts-node/10.9.1_lwgqdwokjtwlohdqtbb6s252kq:
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
@ -4000,7 +4006,7 @@ packages:
'@tsconfig/node12': 1.0.11 '@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3 '@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.3 '@tsconfig/node16': 1.0.3
'@types/node': 18.14.1 '@types/node': 18.15.0
acorn: 8.8.2 acorn: 8.8.2
acorn-walk: 8.2.0 acorn-walk: 8.2.0
arg: 4.1.3 arg: 4.1.3
@ -4131,7 +4137,7 @@ packages:
/validate-npm-package-license/3.0.4: /validate-npm-package-license/3.0.4:
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
dependencies: dependencies:
spdx-correct: 3.1.1 spdx-correct: 3.2.0
spdx-expression-parse: 3.0.1 spdx-expression-parse: 3.0.1
dev: true dev: true

View File

@ -27,7 +27,7 @@ module.exports = async client => {
}, },
}, },
name: 'discord', name: 'discord',
scope: ['identify'], scope: ['applications.commands.permissions.update', 'guilds', 'identify'],
startRedirectPath: '/auth/login', startRedirectPath: '/auth/login',
}); });

View File

@ -3,18 +3,17 @@ const { PermissionsBitField } = require('discord.js');
module.exports.get = fastify => ({ module.exports.get = fastify => ({
handler: async (req, res) => { handler: async (req, res) => {
const { client } = res.context.config; const { client } = res.context.config;
const guilds = client.guilds.cache const guilds = await (await fetch('https://discordapp.com/api/users/@me/guilds', { headers: { 'Authorization': `Bearer ${req.user.payload.access_token}` } })).json();
.filter(async guild => { res.send(
const member = await guild.members.fetch(req.user.payload.id); guilds
if (!member) return false; .filter(guild => guild.owner || new PermissionsBitField(guild.permissions.toString()).has(PermissionsBitField.Flags.ManageGuild))
return member.permissions.has(PermissionsBitField.Flags.ManageGuild); .map(guild => ({
}) added: client.guilds.cache.has(guild.id),
.map(guild => ({ id: guild.id,
id: guild.id, logo: `https://cdn.discordapp.com/icons/${guild.id}/${guild.icon}.webp`,
logo: guild.iconURL(), name: guild.name,
name: guild.name, })),
})); );
res.send(guilds);
}, },
onRequest: [fastify.authenticate], onRequest: [fastify.authenticate],
}); });

View File

@ -1,16 +1,19 @@
const { domain } = require('../../lib/http'); const { domain } = require('../../lib/http');
module.exports.get = () => ({ module.exports.get = () => ({
handler: async function (req, res) { // must NOT use arrow function syntax handler: async function (req, res) { // MUST NOT use arrow function syntax
const { const {
access_token, expires_in, access_token,
expires_in,
} = await this.discord.getAccessTokenFromAuthorizationCodeFlow(req); } = await this.discord.getAccessTokenFromAuthorizationCodeFlow(req);
const user = await (await fetch('https://discordapp.com/api/users/@me', { headers: { 'Authorization': `Bearer ${access_token}` } })).json(); const user = await (await fetch('https://discordapp.com/api/users/@me', { headers: { 'Authorization': `Bearer ${access_token}` } })).json();
const payload = { const payload = {
access_token,
avatar: `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.webp`, avatar: `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.webp`,
discriminator: user.discriminator, discriminator: user.discriminator,
expiresAt: Date.now() + (expires_in * 1000), expiresAt: Date.now() + (expires_in * 1000),
id: user.id, id: user.id,
locale: user.locale,
username: user.username, username: user.username,
}; };

View File

@ -1,5 +1,5 @@
module.exports.get = () => ({ module.exports.get = () => ({
handler: async function (req, res) { // must NOT use arrow function syntax handler: async function (req, res) {
res res
.clearCookie('token', '/') .clearCookie('token', '/')
.send('Logged out.'); .send('Logged out.');