39 Commits

Author SHA1 Message Date
Jacob Nguyen
13cdb8b8cb remove: ModuleConfiguration 2022-09-09 02:06:11 -05:00
Jacob Nguyen
a8f218ff00 revert: delete old files 2022-09-09 02:04:54 -05:00
Jacob Nguyen
fe1b7e4e84 feat: constfn util 2022-09-09 02:02:03 -05:00
Jacob Nguyen
a0f4184c2e feat: add iti di 2022-09-09 02:01:52 -05:00
Jacob Nguyen
1b830d492d feat: add addDependencies 2022-09-09 02:00:44 -05:00
Jacob Nguyen
2189a065c7 chore: edit eslint 2022-09-09 01:59:31 -05:00
Jacob Nguyen
59a956fd0d feat: strengthening contracts 2022-08-31 01:23:16 -05:00
Jacob Nguyen
8183e95a96 feat: refactor ScopedPlugin typing 2022-08-29 12:15:02 -05:00
Jacob Nguyen
355865968a feat: starting from scratch, add new typings 2022-08-29 01:17:26 -05:00
Jacob Nguyen
aca8ae2b13 feat: more merge conflicts 2022-08-28 23:29:05 -05:00
Jacob Nguyen
3f6ce51548 Merge remote-tracking branch 'origin/feat_of_module-manager' into feat_of_module-manager
# Conflicts:
#	package-lock.json
#	package.json
#	src/handler/events/observableHandling.ts
#	src/types/handler.ts
2022-08-28 22:14:05 -05:00
Jacob Nguyen
8c12576f0e chore: saving for later 2022-08-28 22:11:30 -05:00
Jacob Nguyen
a40c7efa19 revert: delete files 2022-08-28 22:11:30 -05:00
Jacob Nguyen
e2471d32cf feat: solidifying contract 2022-08-28 22:11:27 -05:00
Jacob Nguyen
f993e3fd66 feat: adding ModuleConfiguration helper fn and default module manager 2022-08-28 22:11:08 -05:00
Jacob Nguyen
9b51fc0c56 chore: fixing up and cleaning code 2022-08-28 22:11:07 -05:00
Jacob Nguyen
651f4aa35c feat: getting global plugins some typings and adding contracts 2022-08-28 22:11:07 -05:00
Jacob Nguyen
2f10b0e6d2 feat: moving modules to its own contained class 2022-08-28 22:11:07 -05:00
Jacob Nguyen
a0ab4152d1 revert: remove unneeded type predicates 2022-08-28 22:11:07 -05:00
Jacob Nguyen
3b0b94b35a revert: port back to original interaction type checkers 2022-08-28 22:11:07 -05:00
Jacob Nguyen
23edd5b193 revert: port back to original interaction type checkers 2022-08-28 22:11:07 -05:00
Jacob Nguyen
b0e5512686 feat: update location of module typings 2022-08-28 22:11:05 -05:00
Jacob Nguyen
fd9dc35ff0 feat: removing unused types 2022-08-28 22:09:29 -05:00
Jacob Nguyen
813ba0922e feat: prototyping module manager 2022-08-28 22:08:32 -05:00
Jacob Nguyen
0c2f1b513b chore: saving for later 2022-08-28 12:10:55 -05:00
Jacob Nguyen
e85eb81f8b revert: delete files 2022-08-26 00:07:14 -05:00
Jacob Nguyen
a4301dc283 feat: solidifying contract 2022-08-26 00:07:05 -05:00
Jacob Nguyen
3c0da263b2 feat: adding ModuleConfiguration helper fn and default module manager 2022-08-26 00:06:16 -05:00
Jacob Nguyen
8c6fb27989 chore: fixing up and cleaning code 2022-08-26 00:05:22 -05:00
Jacob Nguyen
2830370025 feat: getting global plugins some typings and adding contracts 2022-08-25 00:17:27 -05:00
Jacob Nguyen
4092b9be52 feat: moving modules to its own contained class 2022-08-22 19:50:44 -05:00
Jacob Nguyen
c98425da14 revert: remove unneeded type predicates 2022-08-22 19:45:30 -05:00
Jacob Nguyen
6565697b0c revert: port back to original interaction type checkers 2022-08-22 19:44:53 -05:00
Jacob Nguyen
b94a9e932d revert: port back to original interaction type checkers 2022-08-22 19:44:30 -05:00
Jacob Nguyen
7162ccb928 feat: update location of module typings 2022-08-21 23:11:31 -05:00
Jacob Nguyen
2b6335fba1 feat: removing unused types 2022-08-21 22:46:58 -05:00
Jacob Nguyen
8626add53e feat: prototyping module manager 2022-08-20 22:57:24 -05:00
Jacob Nguyen
74e004d9c1 style: prettier line feed changes 2022-08-19 01:31:14 -05:00
Jacob Nguyen
4323be47d7 style: prettier line feed changes 2022-08-19 01:24:53 -05:00
27 changed files with 384 additions and 289 deletions

View File

@@ -6,6 +6,8 @@
"@typescript-eslint/no-non-null-assertion": "off",
"quotes": [2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
"semi": ["error", "always"],
"@typescript-eslint/no-empty-interface": 0
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/ban-types" : 0
}
}

View File

@@ -71,7 +71,7 @@ client.login(token);
#### ` ping.js (CommonJS)`
```js
const { CommandType, commandModule } = require('@sern/handler');
const { CommandType } = require('@sern/handler');
exports.default = commandModule({
name: 'ping',

361
package-lock.json generated
View File

@@ -9,30 +9,31 @@
"version": "1.1.0",
"license": "MIT",
"dependencies": {
"iti": "^0.4.2",
"rxjs": "^7.5.6",
"ts-pattern": "^4.0.2",
"ts-results-es": "^3.5.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "5.36.1",
"@typescript-eslint/parser": "5.36.1",
"@typescript-eslint/eslint-plugin": "5.35.1",
"@typescript-eslint/parser": "5.35.1",
"eslint": "8.22.0",
"prettier": "2.7.1",
"tsup": "^6.1.3",
"typescript": "4.8.3"
"typescript": "4.7.4"
},
"peerDependencies": {
"discord.js": "^14.2.x"
}
},
"node_modules/@discordjs/builders": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.2.0.tgz",
"integrity": "sha512-ARy4BUTMU+S0ZI6605NDqfWO+qZqV2d/xfY32z3hVSsd9IaAKJBZ1ILTZLy87oIjW8+gUpQmk9Kt0ZP9bmmd8Q==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.1.0.tgz",
"integrity": "sha512-EO8TSltiIc9Z1wE854wAFvv5AccqEtvjFmao9PPoxQhRaJ0hEb7FwWRTCA1jGg4ZWI3hcp4m+RET5ufZQz3rOg==",
"peer": true,
"dependencies": {
"@sapphire/shapeshift": "^3.5.1",
"discord-api-types": "^0.37.3",
"discord-api-types": "^0.36.3",
"fast-deep-equal": "^3.1.3",
"ts-mixer": "^6.0.1",
"tslib": "^2.4.0"
@@ -42,27 +43,27 @@
}
},
"node_modules/@discordjs/collection": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.1.0.tgz",
"integrity": "sha512-PQ2Bv6pnT7aGPCKWbvvNRww5tYCGpggIQVgpuF9TdDPeR6n6vQYxezXiLVOS9z2B62Dp4c+qepQ15SgJbLYtCQ==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.0.1.tgz",
"integrity": "sha512-5V/wswzR3r2RVYXLxxg4TvrAnBhVCNgHTXhC+OUtLoriJ072rPMHo+Iw1SS1vrCckp8Es40XM411+WkNRPaXFw==",
"peer": true,
"engines": {
"node": ">=16.9.0"
}
},
"node_modules/@discordjs/rest": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.1.0.tgz",
"integrity": "sha512-yCrthRTQeUyNThQEpCk7bvQJlwQmz6kU0tf3dcWBv2WX3Bncl41x7Wc+v5b5OsIxfNYq38PvVtWircu9jtYZug==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.0.1.tgz",
"integrity": "sha512-w08CTKVzzYYvKxEjXKOs9AdS7KQ1J502TrPfF8eCZ2lF6AfKuMP/32YgDakiwIyYTDjEQS/v0nKLSFcncHRMtg==",
"peer": true,
"dependencies": {
"@discordjs/collection": "^1.0.1",
"@sapphire/async-queue": "^1.5.0",
"@sapphire/async-queue": "^1.3.2",
"@sapphire/snowflake": "^3.2.2",
"discord-api-types": "^0.37.3",
"file-type": "^17.1.6",
"discord-api-types": "^0.36.3",
"file-type": "^17.1.4",
"tslib": "^2.4.0",
"undici": "^5.9.1"
"undici": "^5.8.0"
},
"engines": {
"node": ">=16.9.0"
@@ -203,9 +204,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "18.7.13",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.13.tgz",
"integrity": "sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw==",
"version": "18.7.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.9.tgz",
"integrity": "sha512-0N5Y1XAdcl865nDdjbO0m3T6FdmQ4ijE89/urOHLREyTXbpMWbSafx9y7XIsgWGtwUP2iYTinLyyW3FatAxBLQ==",
"peer": true
},
"node_modules/@types/ws": {
@@ -218,14 +219,14 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.1.tgz",
"integrity": "sha512-iC40UK8q1tMepSDwiLbTbMXKDxzNy+4TfPWgIL661Ym0sD42vRcQU93IsZIrmi+x292DBr60UI/gSwfdVYexCA==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.35.1.tgz",
"integrity": "sha512-RBZZXZlI4XCY4Wzgy64vB+0slT9+yAPQRjj/HSaRwUot33xbDjF1oN9BLwOLTewoOI0jothIltZRe9uJCHf8gg==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "5.36.1",
"@typescript-eslint/type-utils": "5.36.1",
"@typescript-eslint/utils": "5.36.1",
"@typescript-eslint/scope-manager": "5.35.1",
"@typescript-eslint/type-utils": "5.35.1",
"@typescript-eslint/utils": "5.35.1",
"debug": "^4.3.4",
"functional-red-black-tree": "^1.0.1",
"ignore": "^5.2.0",
@@ -251,14 +252,14 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.36.1.tgz",
"integrity": "sha512-/IsgNGOkBi7CuDfUbwt1eOqUXF9WGVBW9dwEe1pi+L32XrTsZIgmDFIi2RxjzsvB/8i+MIf5JIoTEH8LOZ368A==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.35.1.tgz",
"integrity": "sha512-XL2TBTSrh3yWAsMYpKseBYTVpvudNf69rPOWXWVBI08My2JVT5jR66eTt4IgQFHA/giiKJW5dUD4x/ZviCKyGg==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "5.36.1",
"@typescript-eslint/types": "5.36.1",
"@typescript-eslint/typescript-estree": "5.36.1",
"@typescript-eslint/scope-manager": "5.35.1",
"@typescript-eslint/types": "5.35.1",
"@typescript-eslint/typescript-estree": "5.35.1",
"debug": "^4.3.4"
},
"engines": {
@@ -278,13 +279,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.36.1.tgz",
"integrity": "sha512-pGC2SH3/tXdu9IH3ItoqciD3f3RRGCh7hb9zPdN2Drsr341zgd6VbhP5OHQO/reUqihNltfPpMpTNihFMarP2w==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.35.1.tgz",
"integrity": "sha512-kCYRSAzIW9ByEIzmzGHE50NGAvAP3wFTaZevgWva7GpquDyFPFcmvVkFJGWJJktg/hLwmys/FZwqM9EKr2u24Q==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.36.1",
"@typescript-eslint/visitor-keys": "5.36.1"
"@typescript-eslint/types": "5.35.1",
"@typescript-eslint/visitor-keys": "5.35.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -295,13 +296,12 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.36.1.tgz",
"integrity": "sha512-xfZhfmoQT6m3lmlqDvDzv9TiCYdw22cdj06xY0obSznBsT///GK5IEZQdGliXpAOaRL34o8phEvXzEo/VJx13Q==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.35.1.tgz",
"integrity": "sha512-8xT8ljvo43Mp7BiTn1vxLXkjpw8wS4oAc00hMSB4L1/jIiYbjjnc3Qp2GAUOG/v8zsNCd1qwcqfCQ0BuishHkw==",
"dev": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "5.36.1",
"@typescript-eslint/utils": "5.36.1",
"@typescript-eslint/utils": "5.35.1",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
},
@@ -322,9 +322,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.36.1.tgz",
"integrity": "sha512-jd93ShpsIk1KgBTx9E+hCSEuLCUFwi9V/urhjOWnOaksGZFbTOxAT47OH2d4NLJnLhkVD+wDbB48BuaycZPLBg==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.35.1.tgz",
"integrity": "sha512-FDaujtsH07VHzG0gQ6NDkVVhi1+rhq0qEvzHdJAQjysN+LHDCKDKCBRlZFFE0ec0jKxiv0hN63SNfExy0KrbQQ==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -335,13 +335,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.1.tgz",
"integrity": "sha512-ih7V52zvHdiX6WcPjsOdmADhYMDN15SylWRZrT2OMy80wzKbc79n8wFW0xpWpU0x3VpBz/oDgTm2xwDAnFTl+g==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.35.1.tgz",
"integrity": "sha512-JUqE1+VRTGyoXlDWWjm6MdfpBYVq+hixytrv1oyjYIBEOZhBCwtpp5ZSvBt4wIA1MKWlnaC2UXl2XmYGC3BoQA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.36.1",
"@typescript-eslint/visitor-keys": "5.36.1",
"@typescript-eslint/types": "5.35.1",
"@typescript-eslint/visitor-keys": "5.35.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -362,15 +362,15 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.36.1.tgz",
"integrity": "sha512-lNj4FtTiXm5c+u0pUehozaUWhh7UYKnwryku0nxJlYUEWetyG92uw2pr+2Iy4M/u0ONMKzfrx7AsGBTCzORmIg==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.35.1.tgz",
"integrity": "sha512-v6F8JNXgeBWI4pzZn36hT2HXXzoBBBJuOYvoQiaQaEEjdi5STzux3Yj8v7ODIpx36i/5s8TdzuQ54TPc5AITQQ==",
"dev": true,
"dependencies": {
"@types/json-schema": "^7.0.9",
"@typescript-eslint/scope-manager": "5.36.1",
"@typescript-eslint/types": "5.36.1",
"@typescript-eslint/typescript-estree": "5.36.1",
"@typescript-eslint/scope-manager": "5.35.1",
"@typescript-eslint/types": "5.35.1",
"@typescript-eslint/typescript-estree": "5.35.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0"
},
@@ -386,12 +386,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.1.tgz",
"integrity": "sha512-ojB9aRyRFzVMN3b5joSYni6FAS10BBSCAfKJhjJAV08t/a95aM6tAhz+O1jF+EtgxktuSO3wJysp2R+Def/IWQ==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.35.1.tgz",
"integrity": "sha512-cEB1DvBVo1bxbW/S5axbGPE6b7FIMAbo3w+AGq6zNDA7+NYJOIkKj/sInfTv4edxd4PxJSgdN4t6/pbvgA+n5g==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.36.1",
"@typescript-eslint/types": "5.35.1",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@@ -535,9 +535,9 @@
}
},
"node_modules/bundle-require": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-3.1.0.tgz",
"integrity": "sha512-IIXtAO7fKcwPHNPt9kY/WNVJqy7NDy6YqJvv6ENH0TOZoJ+yjpEsn1w40WKZbR2ibfu5g1rfgJTvmFHpm5aOMA==",
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-3.0.4.tgz",
"integrity": "sha512-VXG6epB1yrLAvWVQpl92qF347/UXmncQj7J3U8kZEbdVZ1ZkQyr4hYeL/9RvcE8vVVdp53dY78Fd/3pqfRqI1A==",
"dev": true,
"dependencies": {
"load-tsconfig": "^0.2.0"
@@ -705,27 +705,27 @@
}
},
"node_modules/discord-api-types": {
"version": "0.37.5",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.5.tgz",
"integrity": "sha512-RhzoX02jw2M+n/AU5K74KTM4J8Sn3ZImUJvoA4lh+SDcrqi1ddSjrafciF4bECj4rPc2vHwoyyTNgbUwE8vbpA==",
"version": "0.36.3",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz",
"integrity": "sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==",
"peer": true
},
"node_modules/discord.js": {
"version": "14.3.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.3.0.tgz",
"integrity": "sha512-CpIwoAAuELiHSgVKRMzsCADS6ZlJwAZ9RlvcJYdEgS00aW36dSvXyBgE+S3pigkc7G+jU6BEalMUWIJFveqrBQ==",
"version": "14.2.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.2.0.tgz",
"integrity": "sha512-kIGhEeOB1d9k7whL9HCCuRuzK2GL7i/hTesYINOZ2szWm4TOsBVwRU+i9O/zDb2M+Gvff4SJ4EpAtCVV0okgVw==",
"peer": true,
"dependencies": {
"@discordjs/builders": "^1.2.0",
"@discordjs/collection": "^1.1.0",
"@discordjs/rest": "^1.1.0",
"@discordjs/builders": "^1.1.0",
"@discordjs/collection": "^1.0.1",
"@discordjs/rest": "^1.0.1",
"@sapphire/snowflake": "^3.2.2",
"@types/ws": "^8.5.3",
"discord-api-types": "^0.37.3",
"discord-api-types": "^0.36.3",
"fast-deep-equal": "^3.1.3",
"lodash.snakecase": "^4.1.1",
"tslib": "^2.4.0",
"undici": "^5.9.1",
"undici": "^5.8.2",
"ws": "^8.8.1"
},
"engines": {
@@ -1423,6 +1423,17 @@
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true
},
"node_modules/iti": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/iti/-/iti-0.4.2.tgz",
"integrity": "sha512-s9MRrz8qn7tig2sIo+YYaPTTdfAECTqew3XsRVPnc1Ytc6yu1p3lcZVYax7k5cuBot3Q7DDuRGtB/JyZd7ogIQ==",
"dependencies": {
"utility-types": "^3.10.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/joycon": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz",
@@ -2292,12 +2303,12 @@
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
},
"node_modules/tsup": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/tsup/-/tsup-6.2.3.tgz",
"integrity": "sha512-J5Pu2Dx0E1wlpIEsVFv9ryzP1pZ1OYsJ2cBHZ7GrKteytNdzaSz5hmLX7/nAxtypq+jVkVvA79d7S83ETgHQ5w==",
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/tsup/-/tsup-6.2.2.tgz",
"integrity": "sha512-vJ9IAdif4GKAz2XMZzjX1hNqhBezJWXjm0qeQEoI7y//a64cxgCF8178eTMV4jBu7YNKnfAPpPSuyXW4mN+9rA==",
"dev": true,
"dependencies": {
"bundle-require": "^3.1.0",
"bundle-require": "^3.0.2",
"cac": "^6.7.12",
"chokidar": "^3.5.1",
"debug": "^4.3.1",
@@ -2391,9 +2402,9 @@
}
},
"node_modules/typescript": {
"version": "4.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz",
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==",
"version": "4.7.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -2404,9 +2415,9 @@
}
},
"node_modules/undici": {
"version": "5.10.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.10.0.tgz",
"integrity": "sha512-c8HsD3IbwmjjbLvoZuRI26TZic+TSEe8FPMLLOkN1AfYRhdjnKBU6yL+IwcSCbdZiX4e5t0lfMDLDCqj4Sq70g==",
"version": "5.9.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.9.1.tgz",
"integrity": "sha512-6fB3a+SNnWEm4CJbgo0/CWR8RGcOCQP68SF4X0mxtYTq2VNN8T88NYrWVBAeSX+zb7bny2dx2iYhP3XHi00omg==",
"peer": true,
"engines": {
"node": ">=12.18"
@@ -2427,6 +2438,14 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"peer": true
},
"node_modules/utility-types": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.10.0.tgz",
"integrity": "sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg==",
"engines": {
"node": ">= 4"
}
},
"node_modules/v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
@@ -2531,37 +2550,37 @@
},
"dependencies": {
"@discordjs/builders": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.2.0.tgz",
"integrity": "sha512-ARy4BUTMU+S0ZI6605NDqfWO+qZqV2d/xfY32z3hVSsd9IaAKJBZ1ILTZLy87oIjW8+gUpQmk9Kt0ZP9bmmd8Q==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.1.0.tgz",
"integrity": "sha512-EO8TSltiIc9Z1wE854wAFvv5AccqEtvjFmao9PPoxQhRaJ0hEb7FwWRTCA1jGg4ZWI3hcp4m+RET5ufZQz3rOg==",
"peer": true,
"requires": {
"@sapphire/shapeshift": "^3.5.1",
"discord-api-types": "^0.37.3",
"discord-api-types": "^0.36.3",
"fast-deep-equal": "^3.1.3",
"ts-mixer": "^6.0.1",
"tslib": "^2.4.0"
}
},
"@discordjs/collection": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.1.0.tgz",
"integrity": "sha512-PQ2Bv6pnT7aGPCKWbvvNRww5tYCGpggIQVgpuF9TdDPeR6n6vQYxezXiLVOS9z2B62Dp4c+qepQ15SgJbLYtCQ==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.0.1.tgz",
"integrity": "sha512-5V/wswzR3r2RVYXLxxg4TvrAnBhVCNgHTXhC+OUtLoriJ072rPMHo+Iw1SS1vrCckp8Es40XM411+WkNRPaXFw==",
"peer": true
},
"@discordjs/rest": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.1.0.tgz",
"integrity": "sha512-yCrthRTQeUyNThQEpCk7bvQJlwQmz6kU0tf3dcWBv2WX3Bncl41x7Wc+v5b5OsIxfNYq38PvVtWircu9jtYZug==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.0.1.tgz",
"integrity": "sha512-w08CTKVzzYYvKxEjXKOs9AdS7KQ1J502TrPfF8eCZ2lF6AfKuMP/32YgDakiwIyYTDjEQS/v0nKLSFcncHRMtg==",
"peer": true,
"requires": {
"@discordjs/collection": "^1.0.1",
"@sapphire/async-queue": "^1.5.0",
"@sapphire/async-queue": "^1.3.2",
"@sapphire/snowflake": "^3.2.2",
"discord-api-types": "^0.37.3",
"file-type": "^17.1.6",
"discord-api-types": "^0.36.3",
"file-type": "^17.1.4",
"tslib": "^2.4.0",
"undici": "^5.9.1"
"undici": "^5.8.0"
}
},
"@eslint/eslintrc": {
@@ -2665,9 +2684,9 @@
"dev": true
},
"@types/node": {
"version": "18.7.13",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.13.tgz",
"integrity": "sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw==",
"version": "18.7.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.9.tgz",
"integrity": "sha512-0N5Y1XAdcl865nDdjbO0m3T6FdmQ4ijE89/urOHLREyTXbpMWbSafx9y7XIsgWGtwUP2iYTinLyyW3FatAxBLQ==",
"peer": true
},
"@types/ws": {
@@ -2680,14 +2699,14 @@
}
},
"@typescript-eslint/eslint-plugin": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.1.tgz",
"integrity": "sha512-iC40UK8q1tMepSDwiLbTbMXKDxzNy+4TfPWgIL661Ym0sD42vRcQU93IsZIrmi+x292DBr60UI/gSwfdVYexCA==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.35.1.tgz",
"integrity": "sha512-RBZZXZlI4XCY4Wzgy64vB+0slT9+yAPQRjj/HSaRwUot33xbDjF1oN9BLwOLTewoOI0jothIltZRe9uJCHf8gg==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "5.36.1",
"@typescript-eslint/type-utils": "5.36.1",
"@typescript-eslint/utils": "5.36.1",
"@typescript-eslint/scope-manager": "5.35.1",
"@typescript-eslint/type-utils": "5.35.1",
"@typescript-eslint/utils": "5.35.1",
"debug": "^4.3.4",
"functional-red-black-tree": "^1.0.1",
"ignore": "^5.2.0",
@@ -2697,53 +2716,52 @@
}
},
"@typescript-eslint/parser": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.36.1.tgz",
"integrity": "sha512-/IsgNGOkBi7CuDfUbwt1eOqUXF9WGVBW9dwEe1pi+L32XrTsZIgmDFIi2RxjzsvB/8i+MIf5JIoTEH8LOZ368A==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.35.1.tgz",
"integrity": "sha512-XL2TBTSrh3yWAsMYpKseBYTVpvudNf69rPOWXWVBI08My2JVT5jR66eTt4IgQFHA/giiKJW5dUD4x/ZviCKyGg==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "5.36.1",
"@typescript-eslint/types": "5.36.1",
"@typescript-eslint/typescript-estree": "5.36.1",
"@typescript-eslint/scope-manager": "5.35.1",
"@typescript-eslint/types": "5.35.1",
"@typescript-eslint/typescript-estree": "5.35.1",
"debug": "^4.3.4"
}
},
"@typescript-eslint/scope-manager": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.36.1.tgz",
"integrity": "sha512-pGC2SH3/tXdu9IH3ItoqciD3f3RRGCh7hb9zPdN2Drsr341zgd6VbhP5OHQO/reUqihNltfPpMpTNihFMarP2w==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.35.1.tgz",
"integrity": "sha512-kCYRSAzIW9ByEIzmzGHE50NGAvAP3wFTaZevgWva7GpquDyFPFcmvVkFJGWJJktg/hLwmys/FZwqM9EKr2u24Q==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.36.1",
"@typescript-eslint/visitor-keys": "5.36.1"
"@typescript-eslint/types": "5.35.1",
"@typescript-eslint/visitor-keys": "5.35.1"
}
},
"@typescript-eslint/type-utils": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.36.1.tgz",
"integrity": "sha512-xfZhfmoQT6m3lmlqDvDzv9TiCYdw22cdj06xY0obSznBsT///GK5IEZQdGliXpAOaRL34o8phEvXzEo/VJx13Q==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.35.1.tgz",
"integrity": "sha512-8xT8ljvo43Mp7BiTn1vxLXkjpw8wS4oAc00hMSB4L1/jIiYbjjnc3Qp2GAUOG/v8zsNCd1qwcqfCQ0BuishHkw==",
"dev": true,
"requires": {
"@typescript-eslint/typescript-estree": "5.36.1",
"@typescript-eslint/utils": "5.36.1",
"@typescript-eslint/utils": "5.35.1",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
}
},
"@typescript-eslint/types": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.36.1.tgz",
"integrity": "sha512-jd93ShpsIk1KgBTx9E+hCSEuLCUFwi9V/urhjOWnOaksGZFbTOxAT47OH2d4NLJnLhkVD+wDbB48BuaycZPLBg==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.35.1.tgz",
"integrity": "sha512-FDaujtsH07VHzG0gQ6NDkVVhi1+rhq0qEvzHdJAQjysN+LHDCKDKCBRlZFFE0ec0jKxiv0hN63SNfExy0KrbQQ==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.1.tgz",
"integrity": "sha512-ih7V52zvHdiX6WcPjsOdmADhYMDN15SylWRZrT2OMy80wzKbc79n8wFW0xpWpU0x3VpBz/oDgTm2xwDAnFTl+g==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.35.1.tgz",
"integrity": "sha512-JUqE1+VRTGyoXlDWWjm6MdfpBYVq+hixytrv1oyjYIBEOZhBCwtpp5ZSvBt4wIA1MKWlnaC2UXl2XmYGC3BoQA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.36.1",
"@typescript-eslint/visitor-keys": "5.36.1",
"@typescript-eslint/types": "5.35.1",
"@typescript-eslint/visitor-keys": "5.35.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -2752,26 +2770,26 @@
}
},
"@typescript-eslint/utils": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.36.1.tgz",
"integrity": "sha512-lNj4FtTiXm5c+u0pUehozaUWhh7UYKnwryku0nxJlYUEWetyG92uw2pr+2Iy4M/u0ONMKzfrx7AsGBTCzORmIg==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.35.1.tgz",
"integrity": "sha512-v6F8JNXgeBWI4pzZn36hT2HXXzoBBBJuOYvoQiaQaEEjdi5STzux3Yj8v7ODIpx36i/5s8TdzuQ54TPc5AITQQ==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.9",
"@typescript-eslint/scope-manager": "5.36.1",
"@typescript-eslint/types": "5.36.1",
"@typescript-eslint/typescript-estree": "5.36.1",
"@typescript-eslint/scope-manager": "5.35.1",
"@typescript-eslint/types": "5.35.1",
"@typescript-eslint/typescript-estree": "5.35.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0"
}
},
"@typescript-eslint/visitor-keys": {
"version": "5.36.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.1.tgz",
"integrity": "sha512-ojB9aRyRFzVMN3b5joSYni6FAS10BBSCAfKJhjJAV08t/a95aM6tAhz+O1jF+EtgxktuSO3wJysp2R+Def/IWQ==",
"version": "5.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.35.1.tgz",
"integrity": "sha512-cEB1DvBVo1bxbW/S5axbGPE6b7FIMAbo3w+AGq6zNDA7+NYJOIkKj/sInfTv4edxd4PxJSgdN4t6/pbvgA+n5g==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.36.1",
"@typescript-eslint/types": "5.35.1",
"eslint-visitor-keys": "^3.3.0"
}
},
@@ -2875,9 +2893,9 @@
}
},
"bundle-require": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-3.1.0.tgz",
"integrity": "sha512-IIXtAO7fKcwPHNPt9kY/WNVJqy7NDy6YqJvv6ENH0TOZoJ+yjpEsn1w40WKZbR2ibfu5g1rfgJTvmFHpm5aOMA==",
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-3.0.4.tgz",
"integrity": "sha512-VXG6epB1yrLAvWVQpl92qF347/UXmncQj7J3U8kZEbdVZ1ZkQyr4hYeL/9RvcE8vVVdp53dY78Fd/3pqfRqI1A==",
"dev": true,
"requires": {
"load-tsconfig": "^0.2.0"
@@ -2995,27 +3013,27 @@
}
},
"discord-api-types": {
"version": "0.37.5",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.5.tgz",
"integrity": "sha512-RhzoX02jw2M+n/AU5K74KTM4J8Sn3ZImUJvoA4lh+SDcrqi1ddSjrafciF4bECj4rPc2vHwoyyTNgbUwE8vbpA==",
"version": "0.36.3",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz",
"integrity": "sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==",
"peer": true
},
"discord.js": {
"version": "14.3.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.3.0.tgz",
"integrity": "sha512-CpIwoAAuELiHSgVKRMzsCADS6ZlJwAZ9RlvcJYdEgS00aW36dSvXyBgE+S3pigkc7G+jU6BEalMUWIJFveqrBQ==",
"version": "14.2.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.2.0.tgz",
"integrity": "sha512-kIGhEeOB1d9k7whL9HCCuRuzK2GL7i/hTesYINOZ2szWm4TOsBVwRU+i9O/zDb2M+Gvff4SJ4EpAtCVV0okgVw==",
"peer": true,
"requires": {
"@discordjs/builders": "^1.2.0",
"@discordjs/collection": "^1.1.0",
"@discordjs/rest": "^1.1.0",
"@discordjs/builders": "^1.1.0",
"@discordjs/collection": "^1.0.1",
"@discordjs/rest": "^1.0.1",
"@sapphire/snowflake": "^3.2.2",
"@types/ws": "^8.5.3",
"discord-api-types": "^0.37.3",
"discord-api-types": "^0.36.3",
"fast-deep-equal": "^3.1.3",
"lodash.snakecase": "^4.1.1",
"tslib": "^2.4.0",
"undici": "^5.9.1",
"undici": "^5.8.2",
"ws": "^8.8.1"
}
},
@@ -3521,6 +3539,14 @@
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true
},
"iti": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/iti/-/iti-0.4.2.tgz",
"integrity": "sha512-s9MRrz8qn7tig2sIo+YYaPTTdfAECTqew3XsRVPnc1Ytc6yu1p3lcZVYax7k5cuBot3Q7DDuRGtB/JyZd7ogIQ==",
"requires": {
"utility-types": "^3.10.0"
}
},
"joycon": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz",
@@ -4116,12 +4142,12 @@
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
},
"tsup": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/tsup/-/tsup-6.2.3.tgz",
"integrity": "sha512-J5Pu2Dx0E1wlpIEsVFv9ryzP1pZ1OYsJ2cBHZ7GrKteytNdzaSz5hmLX7/nAxtypq+jVkVvA79d7S83ETgHQ5w==",
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/tsup/-/tsup-6.2.2.tgz",
"integrity": "sha512-vJ9IAdif4GKAz2XMZzjX1hNqhBezJWXjm0qeQEoI7y//a64cxgCF8178eTMV4jBu7YNKnfAPpPSuyXW4mN+9rA==",
"dev": true,
"requires": {
"bundle-require": "^3.1.0",
"bundle-require": "^3.0.2",
"cac": "^6.7.12",
"chokidar": "^3.5.1",
"debug": "^4.3.1",
@@ -4178,15 +4204,15 @@
"dev": true
},
"typescript": {
"version": "4.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz",
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==",
"version": "4.7.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
"dev": true
},
"undici": {
"version": "5.10.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.10.0.tgz",
"integrity": "sha512-c8HsD3IbwmjjbLvoZuRI26TZic+TSEe8FPMLLOkN1AfYRhdjnKBU6yL+IwcSCbdZiX4e5t0lfMDLDCqj4Sq70g==",
"version": "5.9.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.9.1.tgz",
"integrity": "sha512-6fB3a+SNnWEm4CJbgo0/CWR8RGcOCQP68SF4X0mxtYTq2VNN8T88NYrWVBAeSX+zb7bny2dx2iYhP3XHi00omg==",
"peer": true
},
"uri-js": {
@@ -4204,6 +4230,11 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"peer": true
},
"utility-types": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.10.0.tgz",
"integrity": "sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg=="
},
"v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",

View File

@@ -17,7 +17,8 @@
"lint": "eslint src/**/*.ts",
"format": "eslint src/**/*.ts --fix",
"build": "tsup && node scripts/mkjson.mjs dist/cjs dist/esm && tsup --dts-only --outDir dist",
"publish": "npm run build && npm publish"
"publish": "npm run build && npm publish",
"pretty": "prettier --write ."
},
"keywords": [
"sern-handler",
@@ -31,17 +32,18 @@
"author": "SernDevs",
"license": "MIT",
"dependencies": {
"iti": "^0.4.2",
"rxjs": "^7.5.6",
"ts-pattern": "^4.0.2",
"ts-results-es": "^3.5.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "5.36.1",
"@typescript-eslint/parser": "5.36.1",
"@typescript-eslint/eslint-plugin": "5.35.1",
"@typescript-eslint/parser": "5.35.1",
"eslint": "8.22.0",
"prettier": "2.7.1",
"tsup": "^6.1.3",
"typescript": "4.8.3"
"typescript": "4.7.4"
},
"peerDependencies": {
"discord.js": "^14.2.x"

View File

@@ -0,0 +1,13 @@
import type { SernEventsMapping } from '../../types/handler';
import type { ScopedPlugin } from '../../types/handler';
export interface Logging extends ScopedPlugin {
error(...payload: SernEventsMapping['error']): void;
warning(...payload: SernEventsMapping['warning']): void;
moduleActivate(...warning: SernEventsMapping['module.activate']): void;
moduleRegister(...register: SernEventsMapping['module.register']): void;
}
export interface LoggingConstructor {
new (): Logging;
}

View File

@@ -0,0 +1,15 @@
import type {
CommandModuleDefs,
} from '../../types/module';
import type { CommandType } from '../structures/enums';
import type { CommandModule } from '../../types/module';
import type { ModuleStore } from '../structures/moduleStore';
import type { ScopedPlugin } from '../../types/handler';
export interface ModuleManager extends ScopedPlugin {
readonly moduleStore : ModuleStore;
getModule<T extends CommandType>(type: T, name: string) : CommandModuleDefs[T] | undefined
setModule<T extends CommandType>(type : T, value: Required<CommandModule>) : void
}

View File

@@ -1,12 +1,3 @@
import type {
BothCommand,
ButtonCommand,
ContextMenuMsg,
ContextMenuUser,
ModalSubmitCommand,
SelectMenuCommand,
SlashCommand,
} from '../structures/module';
import Context from '../structures/context';
import type { SlashOptions } from '../../types/handler';
import { asyncResolveArray } from '../utilities/asyncResolveArray';
@@ -21,12 +12,20 @@ import type {
UserContextMenuCommandInteraction,
MessageContextMenuCommandInteraction,
} from 'discord.js';
import { isAutocomplete } from '../utilities/predicates';
import { SernError } from '../structures/errors';
import treeSearch from '../utilities/treeSearch';
import type {
BothCommand,
ButtonCommand,
ContextMenuMsg,
ContextMenuUser,
ModalSubmitCommand,
SelectMenuCommand,
SlashCommand,
} from '../../types/module';
export function applicationCommandDispatcher(interaction: Interaction) {
if (isAutocomplete(interaction)) {
if (interaction.isAutocomplete()) {
return dispatchAutocomplete(interaction);
} else {
const ctx = Context.wrap(interaction as ChatInputCommandInteraction);

View File

@@ -2,14 +2,7 @@ import type { Interaction } from 'discord.js';
import { catchError, concatMap, from, fromEvent, map, Observable } from 'rxjs';
import type Wrapper from '../structures/wrapper';
import { EventsHandler } from './eventsHandler';
import {
isApplicationCommand,
isAutocomplete,
isMessageComponent,
isModalSubmit,
} from '../utilities/predicates';
import * as Files from '../utilities/readFile';
import type { CommandModule } from '../structures/module';
import { SernError } from '../structures/errors';
import { CommandType, PayloadType } from '../structures/enums';
import { match, P } from 'ts-pattern';
@@ -29,6 +22,7 @@ import type {
MessageContextMenuCommandInteraction,
} from 'discord.js';
import { executeModule } from './observableHandling';
import type { CommandModule } from '../../types/module';
export default class InteractionHandler extends EventsHandler<{
event: Interaction;
@@ -60,15 +54,15 @@ export default class InteractionHandler extends EventsHandler<{
override init() {
this.discordEvent.subscribe({
next: event => {
if (isMessageComponent(event)) {
if (event.isMessageComponent()) {
const mod = Files.MessageCompCommands[event.componentType].get(event.customId);
this.setState({ event, mod });
} else if (isApplicationCommand(event) || isAutocomplete(event)) {
} else if (event.isCommand() || event.isAutocomplete()) {
const mod =
Files.ApplicationCommands[event.commandType].get(event.commandName) ??
Files.BothCommands.get(event.commandName);
this.setState({ event, mod });
} else if (isModalSubmit(event)) {
} else if (event.isModalSubmit()) {
/**
* maybe move modal submits into message component object maps?
*/

View File

@@ -6,10 +6,10 @@ import { executeModule, ignoreNonBot, isOneOfCorrectModules } from './observable
import { fmt } from '../utilities/messageHelpers';
import Context from '../structures/context';
import * as Files from '../utilities/readFile';
import type { TextCommand } from '../structures/module';
import { CommandType, PayloadType } from '../structures/enums';
import { asyncResolveArray } from '../utilities/asyncResolveArray';
import { controller } from '../sern';
import type { TextCommand } from '../../types/module';
export default class MessageHandler extends EventsHandler<{
ctx: Context;

View File

@@ -1,11 +1,11 @@
import type { Message } from 'discord.js';
import { concatMap, from, Observable, of, tap, throwError } from 'rxjs';
import { SernError } from '../structures/errors';
import type { Module, CommandModuleDefs, CommandModule } from '../structures/module';
import { Result } from 'ts-results-es';
import type { CommandType } from '../structures/enums';
import type Wrapper from '../structures/wrapper';
import { PayloadType } from '../structures/enums';
import type { CommandModule, CommandModuleDefs, Module } from '../../types/module';
export function ignoreNonBot(prefix: string) {
return (src: Observable<Message>) =>

View File

@@ -1,10 +1,8 @@
import { EventsHandler } from './eventsHandler';
import type Wrapper from '../structures/wrapper';
import { concatMap, fromEvent, Observable, map, take, of, from, toArray, switchMap } from 'rxjs';
import type { CommandModule } from '../structures/module';
import * as Files from '../utilities/readFile';
import { errTap } from './observableHandling';
import type { DefinedCommandModule } from '../../types/handler';
import { basename } from 'path';
import { CommandType, PayloadType, PluginType } from '../structures/enums';
import { processCommandPlugins } from './userDefinedEventsHandling';
@@ -13,6 +11,8 @@ import { SernError } from '../structures/errors';
import { match } from 'ts-pattern';
import { type Result, Err, Ok } from 'ts-results-es';
import { ApplicationCommandType, ComponentType } from 'discord.js';
import type { CommandModule } from '../../types/module';
import type { DefinedCommandModule } from '../../types/handler';
export default class ReadyHandler extends EventsHandler<{
mod: DefinedCommandModule;

View File

@@ -8,13 +8,13 @@ import type {
EventInput,
SpreadParams,
} from '../../types/handler';
import type { EventModule } from '../structures/module';
import { PayloadType } from '../structures/enums';
import type Wrapper from '../structures/wrapper';
import { basename } from 'path';
import { match } from 'ts-pattern';
import { isDiscordEvent, isSernEvent } from '../utilities/predicates';
import { errTap } from './observableHandling';
import type { EventModule } from '../../types/module';
/**
* Utility function to process command plugins for all Modules

View File

@@ -15,7 +15,7 @@ import type { AutocompleteInteraction, Awaitable, Client, ClientEvents } from 'd
import type { Result, Ok, Err } from 'ts-results-es';
import type { CommandType, DefinitelyDefined, Override, SernEventsMapping } from '../../index';
import { EventType, PluginType } from '../../index';
import type { BaseModule, CommandModuleDefs, EventModuleDefs } from '../structures/module';
import type { BaseModule, CommandModuleDefs, EventModuleDefs } from '../../types/module';
import type { EventEmitter } from 'events';
import type {
DiscordEventCommand,

View File

@@ -3,8 +3,7 @@ import { Err, Ok } from 'ts-results-es';
import { ExternalEventEmitters } from './utilities/readFile';
import type { EventEmitter } from 'events';
import { processEvents } from './events/userDefinedEventsHandling';
import type { CommandModule, EventModule } from './structures/module';
import { EventType, PluginType } from './structures/enums';
import { CommandType, EventType, PluginType } from './structures/enums';
import type {
CommandPlugin,
EventModuleCommandPluginDefs,
@@ -17,6 +16,10 @@ import { SernError } from './structures/errors';
import InteractionHandler from './events/interactionHandler';
import ReadyHandler from './events/readyHandler';
import MessageHandler from './events/messageHandler';
import type { CommandModule, EventModule } from '../types/module';
import type { ModuleStore } from './structures/moduleStore';
import type { Client } from 'discord.js';
import type { ModuleConfig, ModuleManagerConstructor } from './contracts/moduleManager';
/**
*
@@ -119,3 +122,10 @@ export function eventModule(mod: InputEventModule): EventModule {
plugins,
} as EventModule;
}
export function ModuleConfiguration<T extends ModuleStore>(
moduleManager : ModuleManagerConstructor<T>,
moduleStore: T,
) : ModuleConfig<T> {
return ( client: Client ) => new moduleManager(client, moduleStore);
}

View File

@@ -0,0 +1,5 @@
import ModuleManager from '../contracts/moduleManager';
import type { CommandModule, CommandModuleDefs } from '../../types/module';
import type { CommandType } from './enums';
import { ModuleStore } from './moduleStore';
import { Logging, LoggingConstructor } from '../contracts/logging';

View File

@@ -1,5 +1,4 @@
import type { Override, SernEventsMapping } from '../../types/handler';
import type { BaseModule } from './module';
import type {
DiscordEmitterPlugin,
DiscordEventPlugin,
@@ -10,6 +9,7 @@ import type {
} from '../plugins/plugin';
import type { Awaitable, ClientEvents } from 'discord.js';
import type { EventType } from './enums';
import type { BaseModule } from '../../types/module';
/*
* Mapped type to generate all sern event modules

View File

@@ -0,0 +1,72 @@
import type { CommandModule } from '../../types/module';
import { ApplicationCommandOptionType, ApplicationCommandType, ComponentType, InteractionType } from 'discord.js';
import type { EventEmitter } from 'events';
import { CommandType } from './enums.js';
import { match } from 'ts-pattern';
import constFn from '../utilities/constantFunction.js';
/**
* Would be a little overkill for a class just for the event emitters?
*/
export const ExternalEventEmitters = new Map<string, EventEmitter>();
/**
* Storing all command modules
*/
export class ModuleStore {
protected readonly BothCommands = new Map<string, CommandModule>();
protected readonly ApplicationCommands = {
[ApplicationCommandType.User]: new Map<string, CommandModule>(),
[ApplicationCommandType.Message]: new Map<string, CommandModule>(),
[ApplicationCommandType.ChatInput]: new Map<string, CommandModule>(),
};
protected readonly InteractionHandlers = {
[ComponentType.Button]: new Map<string, CommandModule>(),
[ComponentType.SelectMenu]: new Map<string, CommandModule>(),
[InteractionType.ModalSubmit] : new Map<string, CommandModule>()
};
protected readonly TextCommands = {
text: new Map<string, CommandModule>(),
aliases: new Map<string, CommandModule>(),
};
/**
*
* @param appType
* Resolves the current map with an ApplicationCommandType
*/
resolveApplicationCommandMap(appType: ApplicationCommandType) {
return this.ApplicationCommands[appType];
}
/**
*
* @param mapping
* Resolves the handler by given component type, or if the type of interaction is a modal submit
*/
resolveInteractionHandlersMap(mapping: ComponentType.Button | ComponentType.SelectMenu | InteractionType.ModalSubmit) {
return this.InteractionHandlers[mapping];
}
/**
*
* @param type
* Resolves the map with a CommandType
*/
resolveMap<T extends CommandType>(type: T) {
return match(type as CommandType)
.with(CommandType.Text, constFn(this.TextCommands.text))
.with(CommandType.Modal, constFn(this.InteractionHandlers[InteractionType.ModalSubmit]))
.with(CommandType.Button, constFn(this.InteractionHandlers[ComponentType.Button]))
.with(CommandType.MenuSelect, constFn(this.InteractionHandlers[ComponentType.SelectMenu]))
.with(CommandType.Both, constFn(this.BothCommands))
.with(CommandType.MenuMsg, constFn(this.ApplicationCommands[ApplicationCommandType.Message]))
.with(CommandType.MenuUser, constFn(this.ApplicationCommands[ApplicationCommandType.User]))
.with(CommandType.Slash, constFn(this.ApplicationCommands[ApplicationCommandType.ChatInput]))
.otherwise(() => {
throw Error('Cannot find a map under this type');
});
}
}

View File

@@ -1,28 +1,8 @@
import Context from './context';
import type {
BothCommand,
Module,
SlashCommand,
TextCommand,
SernOptionsData,
BaseOptions,
SernAutocompleteData,
SernSubCommandData,
SernSubCommandGroupData,
} from './module';
import type Wrapper from './wrapper';
export * from './enums';
export {
Context,
SlashCommand,
TextCommand,
BothCommand,
Module,
Wrapper,
SernOptionsData,
BaseOptions,
SernAutocompleteData,
SernSubCommandData,
SernSubCommandGroupData,
};

View File

@@ -1,12 +1,14 @@
import type { Client } from 'discord.js';
import type SernEmitter from '../sernEmitter';
import type { EventModule } from './module';
import type { EventModule } from '../../types/module';
import type { NodeApi } from 'iti';
/**
* An object to be passed into Sern#init() function.
* @typedef {object} Wrapper
*/
interface Wrapper {
//@deprecrated Use Wrapper#addDependencies instead.
readonly client: Client;
readonly sernEmitter?: SernEmitter;
readonly defaultPrefix?: string;
@@ -15,6 +17,7 @@ interface Wrapper {
| string
| { mod: EventModule; absPath: string }[]
| (() => { mod: EventModule; absPath: string }[]);
readonly addDependencies: (rootBuilder: NodeApi<{}>) => void
}
export default Wrapper;

View File

@@ -0,0 +1,3 @@
export default <T>(value: T) =>
() =>
value;

View File

@@ -1,21 +1,9 @@
import type { CommandModuleDefs, EventModule, Module } from '../structures/module';
import {
AutocompleteInteraction,
Interaction,
InteractionType,
type ModalSubmitInteraction,
type ButtonInteraction,
type SelectMenuInteraction,
type ChatInputCommandInteraction,
type UserContextMenuCommandInteraction,
type MessageContextMenuCommandInteraction,
} from 'discord.js';
import type {
DiscordEventCommand,
ExternalEventCommand,
SernEventCommand,
} from '../structures/events';
import { EventType } from '../..';
import type { CommandModuleDefs, EventModule, Module } from '../../types/module';
export function correctModuleType<T extends keyof CommandModuleDefs>(
plug: Module | undefined,
@@ -26,26 +14,6 @@ export function correctModuleType<T extends keyof CommandModuleDefs>(
return plug !== undefined && (plug.type & type) !== 0;
}
export function isApplicationCommand(
interaction: Interaction,
): interaction is
| ChatInputCommandInteraction
| UserContextMenuCommandInteraction
| MessageContextMenuCommandInteraction {
return interaction.type === InteractionType.ApplicationCommand;
}
export function isModalSubmit(interaction: Interaction): interaction is ModalSubmitInteraction {
return interaction.type === InteractionType.ModalSubmit;
}
export function isAutocomplete(interaction: Interaction): interaction is AutocompleteInteraction {
return interaction.type === InteractionType.ApplicationCommandAutocomplete;
}
export function isMessageComponent(
interaction: Interaction,
): interaction is ButtonInteraction | SelectMenuInteraction {
return interaction.type === InteractionType.MessageComponent;
}
export function isDiscordEvent(el: EventModule): el is DiscordEventCommand {
return el.type === EventType.Discord;
@@ -54,17 +22,3 @@ export function isSernEvent(el: EventModule): el is SernEventCommand {
return el.type === EventType.Sern;
}
export function isExternalEvent(el: EventModule): el is ExternalEventCommand {
return el.type === EventType.External && 'emitter' in el;
}
// export function isEventPlugin<T extends CommandType>(
// e: CommandModulePlugin<T>,
// ): e is EventPlugin<T> {
// return e.type === PluginType.Event;
// }
// export function isCommandPlugin<T extends CommandType>(
// e: CommandModulePlugin<T>,
// ): e is CommandPlugin<T> {
// return !isEventPlugin(e);
// }

View File

@@ -2,10 +2,10 @@ import { ApplicationCommandType, ComponentType } from 'discord.js';
import { readdirSync, statSync } from 'fs';
import { join } from 'path';
import { type Observable, from, concatAll } from 'rxjs';
import type { CommandModule } from '../structures/module';
import { SernError } from '../structures/errors';
import { type Result, Err, Ok } from 'ts-results-es';
import type { EventEmitter } from 'events';
import type { CommandModule } from '../../types/module';
//Maybe move this? this probably doesnt belong in utlities/
export const BothCommands = new Map<string, CommandModule>();

View File

@@ -1,4 +1,4 @@
import type { SernOptionsData } from '../structures/module';
import type { SernOptionsData } from '../../types/module';
import { ApplicationCommandOptionType, AutocompleteInteraction } from 'discord.js';
export default function treeSearch(

View File

@@ -2,6 +2,7 @@ import SernEmitter from './handler/sernEmitter';
export { eventModule, commandModule } from './handler/sern';
export * as Sern from './handler/sern';
export * from './types/handler';
export * from './types/module';
export * from './handler/structures/structxports';
export * from './handler/plugins/plugin';
export { SernEmitter };

View File

@@ -1,6 +1,9 @@
import type { CommandInteractionOptionResolver } from 'discord.js';
import type { CommandModule, EventModule, Module } from '../handler/structures/module';
import type { PayloadType } from '../handler/structures/enums';
import type { CommandModule, EventModule, Module } from './module';
import type { Logging } from '../handler/contracts/logging';
import type { Database } from '../handler/contracts/database';
import type { ModuleManager } from '../handler/contracts/moduleManager';
export type Nullish<T> = T | undefined | null;
// Thanks to @kelsny
@@ -26,11 +29,6 @@ export type EventInput =
| { mod: EventModule; absPath: string }[]
| (() => { mod: EventModule; absPath: string }[]);
export type Reconstruct<T> = T extends Omit<infer O, never> ? O & Reconstruct<O> : T;
export type IsOptional<T> = {
[K in keyof T]-?: T[K] extends Required<T>[K] ? false : true;
};
/**
* Turns a function with a union of array of args into a single union
@@ -44,7 +42,6 @@ export type SpreadParams<T extends (...args: never) => unknown> = (
* After modules are transformed, name and description are given default values if none
* are provided to Module. This type represents that transformation
*/
export type DefinedModule = DefinitelyDefined<Module, 'name' | 'description'>;
export type DefinedCommandModule = DefinitelyDefined<CommandModule, 'name' | 'description'>;
export type DefinedEventModule = DefinitelyDefined<EventModule, 'name' | 'description'>;
export type Payload =
@@ -56,3 +53,15 @@ export type SernEventsMapping = {
['error']: [Payload];
['warning']: [string];
};
export interface ScopedPlugin {
init (dependencies: Map<string, ScopedPlugin>) : void
}
type DependencyMap = {
logger : Logging;
db : Database;
//errorHandling: '';
moduleManager : ModuleManager;
}

View File

@@ -17,17 +17,21 @@ import type {
SelectMenuInteraction,
UserContextMenuCommandInteraction,
} from 'discord.js';
import type { Args, Override, SlashOptions } from '../../types/handler';
import type { AutocompletePlugin, CommandPlugin, EventPlugin } from '../plugins/plugin';
import type Context from './context';
import { CommandType, EventType, PluginType } from './enums';
import type { DiscordEventCommand, ExternalEventCommand, SernEventCommand } from './events';
import type {
DiscordEventCommand,
ExternalEventCommand,
SernEventCommand,
} from '../handler/structures/events';
import { CommandType } from '../handler/structures/enums';
import type { Args, Override, SlashOptions } from './handler';
import type Context from '../handler/structures/context';
import type { AutocompletePlugin, CommandPlugin, EventPlugin } from '../handler/plugins/plugin';
import { EventType } from '../handler/structures/enums';
export interface BaseModule {
type: CommandType | PluginType;
type: CommandType;
name?: string;
description?: string;
execute: (ctx: Context, args: Args) => Awaitable<void | unknown>;
}
export type TextCommand = Override<
@@ -159,9 +163,6 @@ export type EventModuleDefs = {
[EventType.External]: ExternalEventCommand;
};
//TODO: support deeply nested Autocomplete
// objective: construct union of ApplicationCommandOptionData change any Autocomplete data
// into Sern autocomplete data.
export type SernAutocompleteData = Override<
BaseApplicationCommandOptionsData,
@@ -207,4 +208,4 @@ export type SernOptionsData<U extends ApplicationCommandOptionData = Application
? SernSubCommandData
: U extends ApplicationCommandSubGroupData
? SernSubCommandGroupData
: BaseOptions;
: BaseOptions;

View File

@@ -4,6 +4,7 @@
"strict": true,
"esModuleInterop": true,
"noImplicitAny": true,
"experimentalDecorators": true,
"strictNullChecks": true,
"importsNotUsedAsValues": "error",
"moduleResolution": "node",