command-ts 0.0.1 → 0.0.2-dev.20260105052257
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -0
- package/LICENSE +1 -1
- package/out/function/CTSError.d.ts +3 -0
- package/out/function/CTSError.js +10 -0
- package/out/function/debug.d.ts +25 -0
- package/out/function/debug.js +73 -0
- package/out/function/index.d.ts +4 -0
- package/out/function/index.js +20 -0
- package/out/function/read-dir.d.ts +2 -0
- package/out/function/read-dir.js +38 -0
- package/out/function/visual.d.ts +1 -0
- package/out/function/visual.js +60 -0
- package/out/handler/button/index.d.ts +3 -0
- package/out/handler/button/index.js +7 -0
- package/out/handler/command/autocomplete.d.ts +3 -0
- package/out/handler/command/autocomplete.js +4 -0
- package/out/handler/command/execute.d.ts +3 -0
- package/out/handler/command/execute.js +45 -0
- package/out/handler/command/fetch-command.d.ts +2 -0
- package/out/handler/command/fetch-command.js +23 -0
- package/out/handler/command/index.d.ts +3 -0
- package/out/handler/command/index.js +22 -0
- package/out/handler/command/register.d.ts +3 -0
- package/out/handler/command/register.js +15 -0
- package/out/handler/event/fetch-event.d.ts +2 -0
- package/out/handler/event/fetch-event.js +27 -0
- package/out/handler/event/index.d.ts +3 -0
- package/out/handler/event/index.js +11 -0
- package/out/handler/event/on-event.d.ts +2 -0
- package/out/handler/event/on-event.js +23 -0
- package/out/handler/index.d.ts +3 -0
- package/out/handler/index.js +36 -0
- package/out/handler/modal/index.d.ts +3 -0
- package/out/handler/modal/index.js +7 -0
- package/out/handler/selectmenu/channel.d.ts +3 -0
- package/out/handler/selectmenu/channel.js +7 -0
- package/out/handler/selectmenu/index.d.ts +3 -0
- package/out/handler/selectmenu/index.js +7 -0
- package/out/handler/selectmenu/mentionable.d.ts +3 -0
- package/out/handler/selectmenu/mentionable.js +7 -0
- package/out/handler/selectmenu/role.d.ts +3 -0
- package/out/handler/selectmenu/role.js +7 -0
- package/out/handler/selectmenu/string.d.ts +3 -0
- package/out/handler/selectmenu/string.js +7 -0
- package/out/handler/selectmenu/user.d.ts +3 -0
- package/out/handler/selectmenu/user.js +7 -0
- package/out/index.d.ts +4 -1
- package/out/index.js +20 -1
- package/out/type.d.ts +26 -0
- package/out/type.js +28 -0
- package/package.json +17 -10
- package/src/function/CTSError.ts +6 -0
- package/src/function/debug.ts +97 -0
- package/src/function/index.ts +4 -0
- package/src/function/read-dir.ts +46 -0
- package/src/function/visual.ts +69 -0
- package/src/handler/button/index.ts +7 -0
- package/src/handler/command/autocomplete.ts +4 -0
- package/src/handler/command/execute.ts +48 -0
- package/src/handler/command/fetch-command.ts +27 -0
- package/src/handler/command/index.ts +26 -0
- package/src/handler/command/register.ts +15 -0
- package/src/handler/event/fetch-event.ts +35 -0
- package/src/handler/event/index.ts +11 -0
- package/src/handler/event/on-event.ts +25 -0
- package/src/handler/index.ts +33 -0
- package/src/handler/modal/index.ts +7 -0
- package/src/handler/selectmenu/channel.ts +7 -0
- package/src/handler/selectmenu/index.ts +7 -0
- package/src/handler/selectmenu/mentionable.ts +7 -0
- package/src/handler/selectmenu/role.ts +7 -0
- package/src/handler/selectmenu/string.ts +7 -0
- package/src/handler/selectmenu/user.ts +7 -0
- package/src/index.ts +4 -0
- package/src/type.ts +81 -0
- package/tsconfig.json +8 -0
- package/README.md +0 -32
package/src/index.ts
ADDED
package/src/type.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutocompleteInteraction,
|
|
3
|
+
ChannelSelectMenuInteraction,
|
|
4
|
+
ChatInputCommandInteraction,
|
|
5
|
+
Client,
|
|
6
|
+
ClientEvents,
|
|
7
|
+
ContextMenuCommandInteraction,
|
|
8
|
+
MentionableSelectMenuInteraction,
|
|
9
|
+
RESTPostAPIApplicationCommandsJSONBody,
|
|
10
|
+
RoleSelectMenuInteraction,
|
|
11
|
+
StringSelectMenuInteraction,
|
|
12
|
+
UserSelectMenuInteraction,
|
|
13
|
+
ModalSubmitInteraction,
|
|
14
|
+
ButtonInteraction,
|
|
15
|
+
CommandInteraction,
|
|
16
|
+
PrimaryEntryPointCommandInteraction
|
|
17
|
+
} from "discord.js"
|
|
18
|
+
|
|
19
|
+
export type Options = {
|
|
20
|
+
client: Client
|
|
21
|
+
debug?: boolean
|
|
22
|
+
event?: PathOR<keyof ClientEvents, ((...arg: any) => any) | Array<(...arg: any) => any>>
|
|
23
|
+
command?: PathOR<string, Command>
|
|
24
|
+
button?: PathOR<string, (interaction: ButtonInteraction) => any>
|
|
25
|
+
modal?: PathOR<string, (interaction: ModalSubmitInteraction) => any>
|
|
26
|
+
selectmenu?: SelectMenu | string
|
|
27
|
+
middleware?: Array<Middleware> | Middleware
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// export type Commands = {
|
|
31
|
+
// ChatInput?: PathOR<string, (interaction: ChatInputCommandInteraction) => any>
|
|
32
|
+
// Context?: PathOR<string, (interaction: ContextMenuCommandInteraction) => any>
|
|
33
|
+
// }
|
|
34
|
+
|
|
35
|
+
export type SelectMenu = {
|
|
36
|
+
StringSelectMenu?: PathOR<string, (interaction: StringSelectMenuInteraction) => any>
|
|
37
|
+
UserSelectMenu?: PathOR<string, (interaction: UserSelectMenuInteraction) => any>
|
|
38
|
+
RoleSelectMenu?: PathOR<string, (interaction: RoleSelectMenuInteraction) => any>
|
|
39
|
+
MentionableSelectMenu?: PathOR<string, (interaction: MentionableSelectMenuInteraction) => any>
|
|
40
|
+
ChannelSelectMenu?: PathOR<string, (interaction: ChannelSelectMenuInteraction) => any>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type PathOR<key extends string, value extends any> = Map<key, value> | string
|
|
44
|
+
export type StopFunction = (reason?: string) => void
|
|
45
|
+
|
|
46
|
+
export type Command = {
|
|
47
|
+
data: RESTPostAPIApplicationCommandsJSONBody
|
|
48
|
+
autocomplete?: (interaction: AutocompleteInteraction) => any
|
|
49
|
+
run: (
|
|
50
|
+
interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction | PrimaryEntryPointCommandInteraction
|
|
51
|
+
) => any
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type Middleware = (command: Command, interaction: CommandInteraction, stop: StopFunction) => any
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
export type Handler = {
|
|
58
|
+
events?: string
|
|
59
|
+
commands?: string | CommandHandler
|
|
60
|
+
components?: string | ComponentHandler
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type CommandHandler = {
|
|
64
|
+
ChatInput?: string
|
|
65
|
+
Context?: string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type ComponentHandler = {
|
|
69
|
+
Button?: string
|
|
70
|
+
Modal?: string
|
|
71
|
+
SelectMenu?: string | SelectMenuComponentHandler
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type SelectMenuComponentHandler = {
|
|
75
|
+
StringSelectMenu?: string
|
|
76
|
+
UserSelectMenu?: string
|
|
77
|
+
RoleSelectMenu?: string
|
|
78
|
+
MentionableSelectMenu?: string
|
|
79
|
+
ChannelSelectMenu?: string
|
|
80
|
+
}
|
|
81
|
+
*/
|
package/tsconfig.json
ADDED
package/README.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# command-ts
|
|
2
|
-
|
|
3
|
-
[](https://discord.gg/FaCCaFM74Q)
|
|
4
|
-
[](https://github.com/softwarexplus/command-ts/actions)
|
|
5
|
-
[](https://www.npmjs.com/package/command-ts)
|
|
6
|
-
[](https://www.npmjs.com/package/command-ts)
|
|
7
|
-
[](https://www.npmjs.com/package/command-ts)
|
|
8
|
-
[](https://github.com/softwarexplus/command-ts/blob/main/LICENSE)
|
|
9
|
-
|
|
10
|
-
A package for handling discord.js commands with TypeScript
|
|
11
|
-
|
|
12
|
-
## Installation
|
|
13
|
-
|
|
14
|
-
To install command-ts, run one of the following commands based on your preferred package manager:
|
|
15
|
-
|
|
16
|
-
#### NPM
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
npm install command-ts
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
#### PNPM
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
pnpm add command-ts
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
#### Yarn
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
yarn add command-ts
|
|
32
|
-
```
|