Compare commits

...

21 Commits

Author SHA1 Message Date
github-actions[bot]
6a2a5b4565 chore(main): release 2.6.3 (#309)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-17 16:21:26 -05:00
Jacob Nguyen
5fdc1eda7f fix: autocomplete nested option and merge main 2023-06-17 16:16:47 -05:00
renovate[bot]
e00d1df32e chore(deps): update dependency @types/node to v18.16.8 (#299)
chore(deps): update dependency @types/node to v18.16.7

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
2023-06-16 00:13:10 -05:00
renovate[bot]
31c221bd5e chore(deps): update actions/checkout digest to c85c95e (#306)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-16 00:12:42 -05:00
renovate[bot]
0aba4a6606 chore(deps): update dependency prettier to v2.8.8 (#289)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
2023-05-19 20:50:36 -05:00
renovate[bot]
e9c7661804 chore(deps): update dependency discord.js to v14.11.0 (#297)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
2023-05-12 21:15:49 -05:00
renovate[bot]
446417bfb9 chore(deps): update dependency @types/node to v18.16.7 (#291)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
2023-05-10 14:47:30 -05:00
renovate[bot]
6b58ef731b chore(deps): update yarn to v3.5.1 (#296)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-10 13:45:24 -05:00
renovate[bot]
b62129bf04 chore(deps): update dependency rxjs to v7.8.1 (#292)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-10 13:43:21 -05:00
renovate[bot]
3d121ff01c chore(deps): lock file maintenance 2023-04-25 21:24:03 +00:00
renovate[bot]
d201087d4f chore(deps): update dependency eslint to v8.39.0 (#288)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-25 11:51:12 -05:00
renovate[bot]
1af4a2bed4 chore(deps): update dependency @typescript-eslint/parser to v5.59.1 (#287)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-25 11:50:50 -05:00
renovate[bot]
edcaed083e chore(deps): update dependency @types/node to v18.16.0 (#285)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
2023-04-23 23:49:08 -05:00
renovate[bot]
a4fe2c50df chore(deps): update dependency esbuild to ^0.17.0 (#280)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
2023-04-23 23:48:12 -05:00
renovate[bot]
9ea991626d chore(deps): update actions/checkout digest to 8e5e7e5 (#278)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
2023-04-23 23:47:15 -05:00
Jacob Nguyen
64f20f1cf5 Delete non detected license 2023-04-21 16:35:15 -05:00
xxDeveloper
41cc72fe63 chore: README patch (#282)
* docs: Update README.md

It’s better IG

* chore: Update README.md

* chore: Update README.md

* chore; Update README.md

* chore: Update README.md

* chore: Update README.md

* chore: Update README.md

* chore: Update README.md

* chore: Update README.md

* chore: Final updates to README.md
2023-04-18 11:08:20 -05:00
github-actions[bot]
d983f95906 chore(main): release 2.6.2 (#281)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-15 12:42:59 -05:00
Jacob Nguyen
c1f690633c chore: release 2.6.2
Release-As: 2.6.2
2023-04-15 12:40:17 -05:00
Jacob Nguyen
8544d301ef bump version 2023-04-15 12:19:12 -05:00
Jacob Nguyen
52bcba9cfc docs: add deprecation warning 2023-04-15 12:16:35 -05:00
10 changed files with 594 additions and 749 deletions

View File

@@ -20,7 +20,7 @@ jobs:
steps:
- name: Check out Git repository
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3

532
.yarn/releases/yarn-3.5.0.cjs → .yarn/releases/yarn-3.5.1.cjs vendored Normal file → Executable file

File diff suppressed because one or more lines are too long

View File

@@ -2,4 +2,4 @@ enableGlobalCache: true
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.5.0.cjs
yarnPath: .yarn/releases/yarn-3.5.1.cjs

View File

@@ -1,5 +1,19 @@
# Changelog
## [2.6.3](https://github.com/sern-handler/handler/compare/v2.6.2...v2.6.3) (2023-06-17)
### Bug Fixes
* autocomplete nested option and merge main ([5fdc1ed](https://github.com/sern-handler/handler/commit/5fdc1eda7f4fcc1f94af7eca661660c0edeb3251))
## [2.6.2](https://github.com/sern-handler/handler/compare/v2.6.1...v2.6.2) (2023-04-15)
### Miscellaneous Chores
* release 2.6.2 ([c1f6906](https://github.com/sern-handler/handler/commit/c1f690633c55ba41db1e035b7c16f9e19c70b385))
## [2.6.1](https://github.com/sern-handler/handler/compare/v2.6.0...v2.6.1) (2023-03-17)

View File

@@ -1,23 +0,0 @@
MIT License
**Copyright (c) 2022 Sern**
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
End license text.

View File

@@ -15,19 +15,16 @@
</div>
## Why?
- Most handlers don't support discord.js 14.7+
- Customizable, composable commands
- Plug and play or customize to your liking
- Embraces reactive programming for consistent and reliable backend
- Customizable logger, error handling, and more
- Active development and growing [community](https://sern.dev/discord)
## 👀 Quick Look
* Support for discord.js v14 and all interactions
* Hybrid commands
* Lightweight and customizable
* ESM, CommonJS and TypeScript support
* A powerful CLI and awesome community-made plugins
- For you. A framework that's tailored to your exact needs.
- Lightweight. Does a lot while being small.
- Latest features. Support for discord.js v14 and all of its interactions.
- Hybrid, customizable and composable commands. Create them just how you like.
- Start quickly. Plug and play or customize to your liking.
- Embraces reactive programming. For consistent and reliable backend.
- Switch and customize how errors are handled, logging, and more.
- Use it with TypeScript or JavaScript. CommonJS and ESM supported.
- Active and growing community, always here to help. [Join us](https://sern.dev/discord)
- Unleash its full potential with a powerful CLI and awesome plugins.
## 📜 Installation

View File

@@ -1,7 +1,7 @@
{
"name": "@sern/handler",
"packageManager": "yarn@3.5.0",
"version": "2.6.1",
"packageManager": "yarn@3.5.1",
"version": "2.6.3",
"description": "A complete, customizable, typesafe, & reactive framework for discord bots.",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
@@ -41,12 +41,12 @@
"devDependencies": {
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "5.58.0",
"@typescript-eslint/parser": "5.58.0",
"@typescript-eslint/parser": "5.59.1",
"discord.js": "^14.9.0",
"esbuild": "^0.15.2",
"esbuild": "^0.17.0",
"esbuild-ifdef": "^0.2.0",
"eslint": "8.38.0",
"prettier": "2.8.7",
"eslint": "8.39.0",
"prettier": "2.8.8",
"tsup": "^6.7.0",
"typescript": "5.0.2"
},

View File

@@ -6,6 +6,10 @@ import type { Dependencies } from '../../types/handler';
* @typedef {object} Wrapper
*/
interface Wrapper {
/**
* @deprecated
* This will be moved to a new field in 3.0.0
*/
readonly defaultPrefix?: string;
readonly commands: string;
readonly events?: string;

View File

@@ -1,5 +1,6 @@
import { ApplicationCommandOptionType, AutocompleteInteraction } from 'discord.js';
import type { SernAutocompleteData, SernOptionsData } from '../../types/module';
import assert from 'assert';
/**
* Uses an iterative DFS to check if an autocomplete node exists
@@ -11,37 +12,43 @@ export default function treeSearch(
options: SernOptionsData[] | undefined,
): SernAutocompleteData | undefined {
if (options === undefined) return undefined;
const _options = options.slice(); // required to prevent direct mutation of options
let autocompleteData: SernAutocompleteData | undefined;
//clone to prevent mutation of original command module
const _options = options.map(a => ({...a}));
let subcommands = new Set();
while (_options.length > 0) {
const cur = _options.pop()!;
switch (cur.type) {
case ApplicationCommandOptionType.Subcommand:
{
for (const option of cur.options ?? []) {
subcommands.add(cur.name);
for (const option of cur.options ?? [])
_options.push(option);
}
}
break;
case ApplicationCommandOptionType.SubcommandGroup:
{
for (const command of cur.options ?? []) {
for (const command of cur.options ?? [])
_options.push(command);
}
}
break;
default:
{
if (cur.autocomplete) {
if ('autocomplete' in cur && cur.autocomplete) {
const choice = iAutocomplete.options.getFocused(true);
if (cur.name === choice.name && cur.autocomplete) {
autocompleteData = cur;
assert('command' in cur, "No command property found for autocomplete option");
if(subcommands.size > 0) {
const parent = iAutocomplete.options.getSubcommand();
const parentAndOptionMatches = subcommands.has(parent) && cur.name === choice.name;
if (parentAndOptionMatches) {
return cur;
}
} else {
if(cur.name === choice.name) {
return cur;
}
}
}
}
break;
}
}
return autocompleteData;
}
}}

698
yarn.lock

File diff suppressed because it is too large Load Diff