-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor: command builder #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0f60701
chore: rename private areas
vrdons 6ac74bd
refactor: Command Builder
vrdons 02e205a
chore: fix some typing issues
vrdons f499b37
chore: minify packet size
vrdons c94d1a9
deps: remove i18next-fs-backend from deps
vrdons 74cefb3
deps: remove lodash
vrdons File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| CHANGELOG.md | ||
| cargo.toml | ||
| .husky | ||
| cliff.toml | ||
|
|
||
| # Test | ||
| examples | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "command.notfound": "Command not found or disabled1", | ||
| "command.disabled": "Command not found or disabled2" | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| export * from "#structures"; | ||
| export * from "./structures"; | ||
| export * from "./utils/logger/Logger"; | ||
| export * from "#ctx"; | ||
| export * from "./context"; | ||
|
|
||
| export const version = "[VI]{{version}}[/VI]"; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { | ||
| SlashCommandBuilder, | ||
| RESTPostAPIChatInputApplicationCommandsJSONBody, | ||
| } from "discord.js"; | ||
| import { normalizeArray } from "../../utils/normalizeArray"; | ||
| import { Client } from "../core"; | ||
|
|
||
| export interface ApplicationJSONBody extends RESTPostAPIChatInputApplicationCommandsJSONBody { | ||
| prefix_support: boolean; | ||
| slash_support: boolean; | ||
| aliases: string[]; | ||
| } | ||
| export class ApplicationCommandBuilder extends SlashCommandBuilder { | ||
| constructor() { | ||
| super(); | ||
| } | ||
|
fhyrox marked this conversation as resolved.
|
||
| protected prefix_support: boolean = true; | ||
| protected slash_support: boolean = true; | ||
| protected aliases: string[] = []; | ||
|
|
||
| setAliases(...alias: string[]) { | ||
| Reflect.set(this, "aliases", normalizeArray(alias)); | ||
| return this; | ||
| } | ||
|
|
||
| addAliases(...alias: string[]) { | ||
| const currentAliases = Reflect.get(this, "aliases") || []; | ||
| Reflect.set( | ||
| this, | ||
| "aliases", | ||
| normalizeArray([...currentAliases, ...normalizeArray(alias)]) | ||
| ); | ||
| return this; | ||
| } | ||
|
|
||
| setPrefixSupport(support: boolean) { | ||
| Reflect.set(this, "prefix_support", support); | ||
| return this; | ||
| } | ||
|
|
||
| setSlashSupport(support: boolean) { | ||
| Reflect.set(this, "slash_support", support); | ||
| return this; | ||
| } | ||
|
fhyrox marked this conversation as resolved.
|
||
| override toJSON(): ApplicationJSONBody { | ||
| return super.toJSON() as ApplicationJSONBody; | ||
| } | ||
|
fhyrox marked this conversation as resolved.
|
||
|
|
||
| toClientJSON( | ||
| client: Client | ||
| ): ReturnType<ApplicationCommandBuilder["toJSON"]> { | ||
| return { | ||
| ...this.toJSON(), | ||
| }; | ||
| } | ||
|
vrdons marked this conversation as resolved.
|
||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.