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.
Files changed (77) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/LICENSE +1 -1
  3. package/out/function/CTSError.d.ts +3 -0
  4. package/out/function/CTSError.js +10 -0
  5. package/out/function/debug.d.ts +25 -0
  6. package/out/function/debug.js +73 -0
  7. package/out/function/index.d.ts +4 -0
  8. package/out/function/index.js +20 -0
  9. package/out/function/read-dir.d.ts +2 -0
  10. package/out/function/read-dir.js +38 -0
  11. package/out/function/visual.d.ts +1 -0
  12. package/out/function/visual.js +60 -0
  13. package/out/handler/button/index.d.ts +3 -0
  14. package/out/handler/button/index.js +7 -0
  15. package/out/handler/command/autocomplete.d.ts +3 -0
  16. package/out/handler/command/autocomplete.js +4 -0
  17. package/out/handler/command/execute.d.ts +3 -0
  18. package/out/handler/command/execute.js +45 -0
  19. package/out/handler/command/fetch-command.d.ts +2 -0
  20. package/out/handler/command/fetch-command.js +23 -0
  21. package/out/handler/command/index.d.ts +3 -0
  22. package/out/handler/command/index.js +22 -0
  23. package/out/handler/command/register.d.ts +3 -0
  24. package/out/handler/command/register.js +15 -0
  25. package/out/handler/event/fetch-event.d.ts +2 -0
  26. package/out/handler/event/fetch-event.js +27 -0
  27. package/out/handler/event/index.d.ts +3 -0
  28. package/out/handler/event/index.js +11 -0
  29. package/out/handler/event/on-event.d.ts +2 -0
  30. package/out/handler/event/on-event.js +23 -0
  31. package/out/handler/index.d.ts +3 -0
  32. package/out/handler/index.js +36 -0
  33. package/out/handler/modal/index.d.ts +3 -0
  34. package/out/handler/modal/index.js +7 -0
  35. package/out/handler/selectmenu/channel.d.ts +3 -0
  36. package/out/handler/selectmenu/channel.js +7 -0
  37. package/out/handler/selectmenu/index.d.ts +3 -0
  38. package/out/handler/selectmenu/index.js +7 -0
  39. package/out/handler/selectmenu/mentionable.d.ts +3 -0
  40. package/out/handler/selectmenu/mentionable.js +7 -0
  41. package/out/handler/selectmenu/role.d.ts +3 -0
  42. package/out/handler/selectmenu/role.js +7 -0
  43. package/out/handler/selectmenu/string.d.ts +3 -0
  44. package/out/handler/selectmenu/string.js +7 -0
  45. package/out/handler/selectmenu/user.d.ts +3 -0
  46. package/out/handler/selectmenu/user.js +7 -0
  47. package/out/index.d.ts +4 -1
  48. package/out/index.js +20 -1
  49. package/out/type.d.ts +26 -0
  50. package/out/type.js +28 -0
  51. package/package.json +17 -10
  52. package/src/function/CTSError.ts +6 -0
  53. package/src/function/debug.ts +97 -0
  54. package/src/function/index.ts +4 -0
  55. package/src/function/read-dir.ts +46 -0
  56. package/src/function/visual.ts +69 -0
  57. package/src/handler/button/index.ts +7 -0
  58. package/src/handler/command/autocomplete.ts +4 -0
  59. package/src/handler/command/execute.ts +48 -0
  60. package/src/handler/command/fetch-command.ts +27 -0
  61. package/src/handler/command/index.ts +26 -0
  62. package/src/handler/command/register.ts +15 -0
  63. package/src/handler/event/fetch-event.ts +35 -0
  64. package/src/handler/event/index.ts +11 -0
  65. package/src/handler/event/on-event.ts +25 -0
  66. package/src/handler/index.ts +33 -0
  67. package/src/handler/modal/index.ts +7 -0
  68. package/src/handler/selectmenu/channel.ts +7 -0
  69. package/src/handler/selectmenu/index.ts +7 -0
  70. package/src/handler/selectmenu/mentionable.ts +7 -0
  71. package/src/handler/selectmenu/role.ts +7 -0
  72. package/src/handler/selectmenu/string.ts +7 -0
  73. package/src/handler/selectmenu/user.ts +7 -0
  74. package/src/index.ts +4 -0
  75. package/src/type.ts +81 -0
  76. package/tsconfig.json +8 -0
  77. package/README.md +0 -32
@@ -0,0 +1,7 @@
1
+ import { Client } from "discord.js"
2
+ import { SelectMenu } from "../../type"
3
+ import { debug } from "../../function"
4
+
5
+ export function user_handler(data: SelectMenu["UserSelectMenu"], client: Client) {
6
+ debug.info("User select menu handler loaded")
7
+ }
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { version } from "../package.json"
2
+ export * from "./function"
3
+ export * from "./handler"
4
+ export * from "./type"
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
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ "outDir": "./out"
6
+ },
7
+ "include": ["src/**/*"]
8
+ }
package/README.md DELETED
@@ -1,32 +0,0 @@
1
- # command-ts
2
-
3
- [![Discord](https://img.shields.io/discord/1211530334458617866?style=flat&logo=discord&logoColor=ffffff&color=5865f2)](https://discord.gg/FaCCaFM74Q)
4
- [![GitHub Action](https://github.com/softwarexplus/command-ts/actions/workflows/test.yaml/badge.svg)](https://github.com/softwarexplus/command-ts/actions)
5
- [![NPM Version](https://img.shields.io/npm/v/command-ts)](https://www.npmjs.com/package/command-ts)
6
- [![NPM Downloads](https://img.shields.io/npm/dy/command-ts)](https://www.npmjs.com/package/command-ts)
7
- [![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/command-ts)](https://www.npmjs.com/package/command-ts)
8
- [![NPM License](https://img.shields.io/npm/l/command-ts)](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
- ```