nuxt-discord 0.0.17 → 0.1.0

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 (112) hide show
  1. package/README.md +249 -171
  2. package/dist/module.d.mts +108 -10
  3. package/dist/module.json +3 -3
  4. package/dist/module.mjs +966 -345
  5. package/dist/runtime/acknowledgement.d.ts +10 -0
  6. package/dist/runtime/acknowledgement.js +124 -0
  7. package/dist/runtime/client/chat-theme.css +52 -0
  8. package/dist/runtime/client/components/ChatAvatar.d.vue.ts +6 -0
  9. package/dist/runtime/client/components/ChatAvatar.vue +11 -0
  10. package/dist/runtime/client/components/ChatAvatar.vue.d.ts +6 -0
  11. package/dist/runtime/client/components/CommandPicker.d.vue.ts +24 -0
  12. package/dist/runtime/client/components/CommandPicker.vue +67 -0
  13. package/dist/runtime/client/components/CommandPicker.vue.d.ts +24 -0
  14. package/dist/runtime/client/components/CommandTestBar.d.vue.ts +60 -0
  15. package/dist/runtime/client/components/CommandTestBar.vue +335 -0
  16. package/dist/runtime/client/components/CommandTestBar.vue.d.ts +60 -0
  17. package/dist/runtime/client/components/CommandTranscript.d.vue.ts +39 -0
  18. package/dist/runtime/client/components/CommandTranscript.vue +147 -0
  19. package/dist/runtime/client/components/CommandTranscript.vue.d.ts +39 -0
  20. package/dist/runtime/client/components/ProjectLogo.d.vue.ts +3 -0
  21. package/dist/runtime/client/components/ProjectLogo.vue +31 -0
  22. package/dist/runtime/client/components/ProjectLogo.vue.d.ts +3 -0
  23. package/dist/runtime/client/components/TheHeader.d.vue.ts +3 -0
  24. package/dist/runtime/client/components/TheHeader.vue +53 -16
  25. package/dist/runtime/client/components/TheHeader.vue.d.ts +2 -2
  26. package/dist/runtime/client/components/appearance-select.d.ts +17 -0
  27. package/dist/runtime/client/components/appearance-select.js +15 -0
  28. package/dist/runtime/client/pages/activity.d.vue.ts +3 -0
  29. package/dist/runtime/client/pages/activity.vue +202 -0
  30. package/dist/runtime/client/pages/activity.vue.d.ts +3 -0
  31. package/dist/runtime/client/pages/context-menus.d.vue.ts +3 -0
  32. package/dist/runtime/client/pages/context-menus.vue +120 -0
  33. package/dist/runtime/client/pages/context-menus.vue.d.ts +3 -0
  34. package/dist/runtime/client/pages/listeners.d.vue.ts +3 -0
  35. package/dist/runtime/client/pages/listeners.vue +68 -0
  36. package/dist/runtime/client/pages/listeners.vue.d.ts +3 -0
  37. package/dist/runtime/client/pages/overview.d.vue.ts +3 -0
  38. package/dist/runtime/client/pages/overview.vue +280 -0
  39. package/dist/runtime/client/pages/overview.vue.d.ts +3 -0
  40. package/dist/runtime/client/pages/slash-commands.d.vue.ts +3 -0
  41. package/dist/runtime/client/pages/slash-commands.vue +185 -359
  42. package/dist/runtime/client/pages/slash-commands.vue.d.ts +2 -3
  43. package/dist/runtime/client/style.css +4 -1
  44. package/dist/runtime/client/useActivityLog.d.ts +7 -0
  45. package/dist/runtime/client/useActivityLog.js +76 -0
  46. package/dist/runtime/client/useCommandRegistry.d.ts +7 -0
  47. package/dist/runtime/client/useCommandRegistry.js +34 -0
  48. package/dist/runtime/client/useDashboardCatalog.d.ts +5 -0
  49. package/dist/runtime/client/useDashboardCatalog.js +9 -0
  50. package/dist/runtime/dashboard/auth.d.ts +4 -0
  51. package/dist/runtime/dashboard/auth.js +65 -0
  52. package/dist/runtime/dashboard/oauth.d.ts +3 -0
  53. package/dist/runtime/dashboard/oauth.js +151 -0
  54. package/dist/runtime/dashboard/permissions.d.ts +4 -0
  55. package/dist/runtime/dashboard/permissions.js +84 -0
  56. package/dist/runtime/dashboard/signin.d.ts +2 -0
  57. package/dist/runtime/dashboard/signin.js +39 -0
  58. package/dist/runtime/diagnostics.d.ts +4 -0
  59. package/dist/runtime/diagnostics.js +24 -0
  60. package/dist/runtime/discordInvocation.d.ts +14 -0
  61. package/dist/runtime/discordInvocation.js +28 -0
  62. package/dist/runtime/middleware.d.ts +1 -0
  63. package/dist/runtime/middleware.js +12 -0
  64. package/dist/runtime/registration.d.ts +65 -0
  65. package/dist/runtime/registration.js +354 -0
  66. package/dist/runtime/server/api/discord/activity.get.d.ts +2 -0
  67. package/dist/runtime/server/api/discord/activity.get.js +6 -0
  68. package/dist/runtime/server/api/discord/catalog.get.d.ts +2 -0
  69. package/dist/runtime/server/api/discord/catalog.get.js +3 -0
  70. package/dist/runtime/server/api/discord/slash-command/autocomplete.post.d.ts +2 -0
  71. package/dist/runtime/server/api/discord/slash-command/autocomplete.post.js +14 -0
  72. package/dist/runtime/server/api/discord/slash-command/register.post.d.ts +1 -1
  73. package/dist/runtime/server/api/discord/slash-command/register.post.js +1 -1
  74. package/dist/runtime/server/api/discord/slash-command/remote-all.get.d.ts +1 -1
  75. package/dist/runtime/server/api/discord/slash-command/remote-diff.post.d.ts +1 -238
  76. package/dist/runtime/server/api/discord/slash-command/remote-diff.post.js +3 -1
  77. package/dist/runtime/server/api/discord/slash-command/test.post.d.ts +20 -0
  78. package/dist/runtime/server/api/discord/slash-command/test.post.js +19 -0
  79. package/dist/runtime/server/plugins/discord.js +93 -31
  80. package/dist/runtime/server/utils/client.d.ts +59 -246
  81. package/dist/runtime/server/utils/client.js +413 -451
  82. package/dist/runtime/server/utils/defineContextMenu.d.ts +49 -0
  83. package/dist/runtime/server/utils/defineContextMenu.js +12 -0
  84. package/dist/runtime/server/utils/defineListener.d.ts +24 -0
  85. package/dist/runtime/server/utils/defineListener.js +7 -0
  86. package/dist/runtime/server/utils/defineMiddleware.d.ts +29 -0
  87. package/dist/runtime/server/utils/defineMiddleware.js +24 -0
  88. package/dist/runtime/server/utils/describeCommand.d.ts +2 -0
  89. package/dist/runtime/server/utils/describeOption.d.ts +1 -1
  90. package/dist/runtime/server/utils/messageSender.d.ts +37 -0
  91. package/dist/runtime/server/utils/messageSender.js +149 -0
  92. package/dist/runtime/server/utils/middleware/cooldown.d.ts +1 -0
  93. package/dist/runtime/server/utils/middleware/cooldown.js +39 -0
  94. package/dist/runtime/server/utils/middleware/guildOnly.d.ts +1 -0
  95. package/dist/runtime/server/utils/middleware/guildOnly.js +6 -0
  96. package/dist/runtime/server/utils/middleware/ownerOnly.d.ts +1 -0
  97. package/dist/runtime/server/utils/middleware/ownerOnly.js +10 -0
  98. package/dist/runtime/server/utils/middleware/requireRole.d.ts +1 -0
  99. package/dist/runtime/server/utils/middleware/requireRole.js +15 -0
  100. package/dist/runtime/server/utils/reply.d.ts +13 -3
  101. package/dist/runtime/server/utils/reply.js +111 -162
  102. package/dist/runtime/server/utils/simulateInteraction.d.ts +20 -0
  103. package/dist/runtime/server/utils/simulateInteraction.js +127 -0
  104. package/dist/runtime/server/utils/useTextChannel.d.ts +56 -0
  105. package/dist/runtime/server/utils/useTextChannel.js +105 -0
  106. package/dist/types.d.mts +11 -1
  107. package/dist/types.d.ts +11 -1
  108. package/package.json +62 -44
  109. package/dist/runtime/client/components/TheHeader.css +0 -1
  110. package/dist/runtime/client/pages/slash-commands.css +0 -1
  111. package/dist/runtime/client/uno.config.d.ts +0 -2
  112. package/dist/runtime/client/uno.config.js +0 -10
@@ -0,0 +1,10 @@
1
+ import type { CommandInteraction, InteractionReplyOptions, MessageCreateOptions, ModalSubmitInteraction } from 'discord.js';
2
+ import type { MessageSenderConfig, SentMessage } from './server/utils/messageSender.js';
3
+ type ReplyInteraction = CommandInteraction | ModalSubmitInteraction;
4
+ export type DeferPolicy = 'public' | 'private' | 'manual';
5
+ export declare function scheduleAcknowledgement(interaction: ReplyInteraction, policy?: DeferPolicy, allowTimer?: boolean): () => void;
6
+ export declare function wasAutomaticallyDeferred(interaction: ReplyInteraction): boolean;
7
+ export declare function interactionSender(interaction: ReplyInteraction): Omit<MessageSenderConfig, 'send'> & {
8
+ send: (opts: InteractionReplyOptions | MessageCreateOptions) => Promise<SentMessage>;
9
+ };
10
+ export {};
@@ -0,0 +1,124 @@
1
+ import { MessageFlags, MessageFlagsBitField, MessagePayload } from "discord.js";
2
+ import { logDiscordFailure } from "./diagnostics.js";
3
+ const privateByDefault = /* @__PURE__ */ new WeakSet();
4
+ const automatic = /* @__PURE__ */ new WeakMap();
5
+ export function scheduleAcknowledgement(interaction, policy, allowTimer = true) {
6
+ if (policy === "manual")
7
+ return () => {
8
+ };
9
+ if (policy === "private")
10
+ privateByDefault.add(interaction);
11
+ const elapsed = Date.now() - (interaction.createdTimestamp ?? Date.now());
12
+ const originalDefer = interaction.deferReply;
13
+ const restoreMethods = [];
14
+ const timer = allowTimer ? setTimeout(() => {
15
+ if (interaction.replied || interaction.deferred)
16
+ return;
17
+ const pending = originalDefer.call(interaction, policy === "public" ? {} : { flags: MessageFlags.Ephemeral });
18
+ automatic.set(interaction, { policy, pending });
19
+ void pending.catch((error) => logDiscordFailure("Could not defer interaction:", error));
20
+ }, Math.max(0, 1800 - elapsed)) : void 0;
21
+ timer?.unref();
22
+ const cancel = () => {
23
+ clearTimeout(timer);
24
+ for (const restore of restoreMethods.splice(0))
25
+ restore();
26
+ };
27
+ for (const method of ["reply", "deferReply", "showModal"]) {
28
+ const original = Reflect.get(interaction, method);
29
+ if (typeof original !== "function")
30
+ continue;
31
+ const descriptor = Object.getOwnPropertyDescriptor(interaction, method);
32
+ Object.defineProperty(interaction, method, {
33
+ configurable: true,
34
+ writable: true,
35
+ value(...args) {
36
+ cancel();
37
+ const ack = automatic.get(this);
38
+ if (method === "reply" && (ack || policy === "private")) {
39
+ const payload = args[0];
40
+ const options = typeof payload === "string" ? { content: payload } : payload instanceof MessagePayload ? payload.options : payload;
41
+ const opts = options;
42
+ if (ack)
43
+ return interactionSender(this).send(opts);
44
+ return Reflect.apply(original, this, [withPrivateFlag(opts)]);
45
+ }
46
+ if (method === "deferReply") {
47
+ const opts = args[0] ?? {};
48
+ if (ack) {
49
+ if (ack.policy === "public" && isPrivate(opts))
50
+ throw new Error("This interaction was already deferred publicly. Declare defer: 'private' or 'manual' before running this command.");
51
+ if (opts.withResponse)
52
+ throw new Error("To receive the original acknowledgement callback, declare defer: 'manual'.");
53
+ return opts.fetchReply ? ack.pending.then(() => this.fetchReply()) : ack.pending;
54
+ }
55
+ if (policy === "private")
56
+ return Reflect.apply(original, this, [{ ...opts, flags: MessageFlags.Ephemeral }]);
57
+ }
58
+ if (method === "showModal" && ack)
59
+ throw new Error("Discord requires a modal to be the first response. For a slow modal command, declare defer: 'manual' and acknowledge within three seconds.");
60
+ return Reflect.apply(original, this, args);
61
+ }
62
+ });
63
+ restoreMethods.push(() => {
64
+ if (descriptor)
65
+ Object.defineProperty(interaction, method, descriptor);
66
+ else
67
+ Reflect.deleteProperty(interaction, method);
68
+ });
69
+ }
70
+ return cancel;
71
+ }
72
+ function isPrivate(opts) {
73
+ return opts.ephemeral || new MessageFlagsBitField(opts.flags).has(MessageFlags.Ephemeral);
74
+ }
75
+ function withPrivateFlag(opts) {
76
+ const flags = new MessageFlagsBitField(opts.flags).add(MessageFlags.Ephemeral);
77
+ return { ...opts, flags: flags.bitfield };
78
+ }
79
+ function editOptions(options) {
80
+ const { flags, ephemeral: _ephemeral, withResponse: _withResponse, fetchReply: _fetchReply, tts: _tts, ...editable } = options;
81
+ if (flags == null)
82
+ return editable;
83
+ const bits = new MessageFlagsBitField(flags).bitfield;
84
+ const writable = bits & (MessageFlags.SuppressEmbeds | MessageFlags.IsComponentsV2);
85
+ return { ...editable, flags: writable };
86
+ }
87
+ export function wasAutomaticallyDeferred(interaction) {
88
+ return automatic.has(interaction);
89
+ }
90
+ export function interactionSender(interaction) {
91
+ let method;
92
+ return {
93
+ async send(options) {
94
+ let opts = options;
95
+ if (!interaction.replied && privateByDefault.has(interaction) && !isPrivate(opts))
96
+ opts = withPrivateFlag(opts);
97
+ const ack = automatic.get(interaction);
98
+ if (ack)
99
+ await ack.pending;
100
+ method = interaction.replied ? "followUp" : interaction.deferred ? "editReply" : "reply";
101
+ if (method === "editReply") {
102
+ const explicitlyPrivate = isPrivate(opts);
103
+ const originalPrivate = ack ? ack.policy !== "public" : interaction.ephemeral;
104
+ if (explicitlyPrivate && originalPrivate === false || ack && explicitlyPrivate !== originalPrivate) {
105
+ await interaction.editReply({ content: "Preparing reply\u2026" });
106
+ method = "followUp";
107
+ const message = await interaction.followUp(opts);
108
+ await interaction.deleteReply().catch((error) => logDiscordFailure("Could not remove acknowledgement:", error));
109
+ return message;
110
+ }
111
+ return interaction.editReply(editOptions(opts));
112
+ }
113
+ return interaction[method](opts);
114
+ },
115
+ edit(msg, options) {
116
+ const opts = editOptions(options);
117
+ if (method === "editReply" || "resource" in msg)
118
+ return interaction.editReply(opts);
119
+ if (method === "followUp" && "id" in msg && interaction.webhook)
120
+ return interaction.webhook.editMessage(msg.id, opts);
121
+ return msg.edit(opts);
122
+ }
123
+ };
124
+ }
@@ -0,0 +1,52 @@
1
+ @import "@fontsource-variable/source-sans-3/wght.css";
2
+
3
+ /* Nuxt applies the preferred class before paint. Follow the OS until it does. */
4
+ @custom-variant dark-palette {
5
+ &:where(.dark) { @slot; }
6
+ @media (prefers-color-scheme: dark) {
7
+ &:where(:not(.light, .dark)) { @slot; }
8
+ }
9
+ }
10
+
11
+ @theme {
12
+ --font-chat: "Source Sans 3 Variable", "Helvetica Neue", Arial, sans-serif;
13
+ --color-chat-canvas: #ffffff;
14
+ --color-chat-sidebar: #f2f3f5;
15
+ --color-chat-field: #f5f5f7;
16
+ --color-chat-panel: #ffffff;
17
+ --color-chat-hover: #e0e1e5;
18
+ --color-chat-line: #d1d2d8;
19
+ --color-chat-text: #232428;
20
+ --color-chat-muted: #4e5058;
21
+ --color-chat-faint: #5c5e66;
22
+ --color-chat-link: #174c92;
23
+ --color-chat-brand: #505bdc;
24
+ --color-chat-error: #a32c32;
25
+ }
26
+
27
+ :root {
28
+ @variant dark-palette {
29
+ --color-chat-canvas: #1b1b1f;
30
+ --color-chat-sidebar: #141417;
31
+ --color-chat-field: #222328;
32
+ --color-chat-panel: #242429;
33
+ --color-chat-hover: #333339;
34
+ --color-chat-line: #38383e;
35
+ --color-chat-text: #ededf0;
36
+ --color-chat-muted: #b5b5bd;
37
+ --color-chat-faint: #929299;
38
+ --color-chat-link: #78aff4;
39
+ --color-chat-brand: #5865f2;
40
+ --color-chat-error: #ff9e9e;
41
+ }
42
+ }
43
+
44
+ @media (forced-colors: active) {
45
+ :root {
46
+ --color-chat-canvas: Canvas;
47
+ --color-chat-panel: Canvas;
48
+ --color-chat-text: CanvasText;
49
+ --color-chat-line: ButtonBorder;
50
+ --color-chat-link: LinkText;
51
+ }
52
+ }
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ user?: boolean;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ defineProps({
3
+ user: { type: Boolean, required: false }
4
+ });
5
+ </script>
6
+
7
+ <template>
8
+ <span aria-hidden="true" class="inline-grid shrink-0 place-items-center rounded-full text-white" :class="user ? 'bg-[#69727c]' : 'bg-[#df4748]'">
9
+ <UIcon name="i-simple-icons-discord" class="size-[60%]" />
10
+ </span>
11
+ </template>
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ user?: boolean;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
@@ -0,0 +1,24 @@
1
+ export interface PickerItem {
2
+ name: string;
3
+ value: string;
4
+ description?: string;
5
+ required?: string[];
6
+ optional?: number;
7
+ }
8
+ type __VLS_Props = {
9
+ id: string;
10
+ label: string;
11
+ items: PickerItem[];
12
+ index: number;
13
+ commands?: boolean;
14
+ searching?: boolean;
15
+ };
16
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ highlight: (index: number) => any;
18
+ choose: (item: PickerItem) => any;
19
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
20
+ onHighlight?: ((index: number) => any) | undefined;
21
+ onChoose?: ((item: PickerItem) => any) | undefined;
22
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const _default: typeof __VLS_export;
24
+ export default _default;
@@ -0,0 +1,67 @@
1
+ <script setup>
2
+ import { useTemplateRef, watch } from "vue";
3
+ import ChatAvatar from "./ChatAvatar.vue";
4
+ const props = defineProps({
5
+ id: { type: String, required: true },
6
+ label: { type: String, required: true },
7
+ items: { type: Array, required: true },
8
+ index: { type: Number, required: true },
9
+ commands: { type: Boolean, required: false },
10
+ searching: { type: Boolean, required: false }
11
+ });
12
+ defineEmits(["choose", "highlight"]);
13
+ const list = useTemplateRef("list");
14
+ watch(() => props.index, (index) => {
15
+ const el = list.value;
16
+ const row = document.getElementById(`${props.id}-${index}`);
17
+ if (!el || !row)
18
+ return;
19
+ const panel = el.getBoundingClientRect();
20
+ const item = row.getBoundingClientRect();
21
+ if (item.top < panel.top)
22
+ el.scrollTop += item.top - panel.top;
23
+ else if (item.bottom > panel.bottom)
24
+ el.scrollTop += item.bottom - panel.bottom;
25
+ }, { flush: "post" });
26
+ </script>
27
+
28
+ <template>
29
+ <div class="absolute inset-x-2 bottom-full z-20 mb-1.5 flex max-h-[min(26.25rem,55dvh,var(--picker-space,55dvh))] overflow-hidden rounded bg-chat-panel shadow-[0_4px_18px_#0005] ring-1 ring-black/20">
30
+ <div v-if="commands && !searching" aria-hidden="true" class="flex w-[2.875rem] shrink-0 justify-center bg-chat-sidebar pt-3">
31
+ <ChatAvatar class="size-8" />
32
+ </div>
33
+ <div :id="id" ref="list" role="listbox" :aria-label="label" class="min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-y-none px-2 py-1.5">
34
+ <h3 class="px-2 py-1.5 text-sm font-semibold">
35
+ {{ label }}
36
+ </h3>
37
+ <div
38
+ v-for="(item, i) in items" :id="`${id}-${i}`" :key="item.value" role="option"
39
+ :aria-selected="i === index" class="flex cursor-pointer items-center gap-4 rounded px-2 aria-selected:bg-chat-hover"
40
+ :class="commands ? 'min-h-14' : 'min-h-10'"
41
+ @pointermove="$event.pointerType === 'mouse' && $emit('highlight', i)" @pointerdown.prevent @click="$emit('choose', item)"
42
+ >
43
+ <ChatAvatar v-if="commands && searching" class="size-8" />
44
+ <div class="min-w-0 flex-1">
45
+ <div class="flex flex-wrap items-center gap-1.5">
46
+ <span class="font-medium">{{ item.name }}</span>
47
+ <span v-for="arg in item.required" :key="arg" class="rounded-sm bg-chat-text/10 px-1 text-sm leading-[1.25]">{{ arg }}</span>
48
+ <span v-if="item.optional" class="text-xs text-chat-muted">+{{ item.optional }} optional</span>
49
+ </div>
50
+ <p v-if="item.description" class="truncate text-xs leading-[1.5] text-chat-muted">
51
+ {{ item.description }}
52
+ </p>
53
+ </div>
54
+ <span v-if="commands && searching" class="hidden shrink-0 text-xs text-chat-muted sm:inline">nuxt-discord</span>
55
+ </div>
56
+ <p v-if="!items.length" class="p-2 text-sm text-chat-muted">
57
+ No commands found
58
+ </p>
59
+ </div>
60
+ </div>
61
+ </template>
62
+
63
+ <style scoped>
64
+ @media (forced-colors: active) {
65
+ [role="option"][aria-selected="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
66
+ }
67
+ </style>
@@ -0,0 +1,24 @@
1
+ export interface PickerItem {
2
+ name: string;
3
+ value: string;
4
+ description?: string;
5
+ required?: string[];
6
+ optional?: number;
7
+ }
8
+ type __VLS_Props = {
9
+ id: string;
10
+ label: string;
11
+ items: PickerItem[];
12
+ index: number;
13
+ commands?: boolean;
14
+ searching?: boolean;
15
+ };
16
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ highlight: (index: number) => any;
18
+ choose: (item: PickerItem) => any;
19
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
20
+ onHighlight?: ((index: number) => any) | undefined;
21
+ onChoose?: ((item: PickerItem) => any) | undefined;
22
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const _default: typeof __VLS_export;
24
+ export default _default;
@@ -0,0 +1,60 @@
1
+ interface Option {
2
+ name: string;
3
+ description: string;
4
+ required: boolean;
5
+ type: number;
6
+ choices?: {
7
+ name: string;
8
+ value: string | number;
9
+ }[];
10
+ minLength?: number;
11
+ maxLength?: number;
12
+ min?: number;
13
+ max?: number;
14
+ hasAutocomplete?: boolean;
15
+ }
16
+ interface Command {
17
+ name: string;
18
+ description: string;
19
+ options: Option[];
20
+ subcommands?: Command[];
21
+ }
22
+ interface TestResult {
23
+ ephemeral?: boolean;
24
+ ok: boolean;
25
+ response?: string;
26
+ responses?: string[];
27
+ replies?: {
28
+ content: string;
29
+ ephemeral: boolean;
30
+ }[];
31
+ notices?: string[];
32
+ error?: string;
33
+ }
34
+ interface TestRequest {
35
+ name: string;
36
+ options: Record<string, string>;
37
+ }
38
+ type __VLS_Props = {
39
+ commands: Command[];
40
+ channel?: boolean;
41
+ search?: string;
42
+ pinned?: boolean;
43
+ suggest?: (command: string, option: string, value: string) => NonNullable<Option['choices']>;
44
+ execute?: (body: TestRequest) => TestResult | Promise<TestResult>;
45
+ };
46
+ declare const __VLS_template: () => {
47
+ __VLS_Slots: {
48
+ default?: (props: {}) => any;
49
+ };
50
+ };
51
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
52
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
53
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
54
+ declare const _default: typeof __VLS_export;
55
+ export default _default;
56
+ type __VLS_WithSlots<T, S> = T & {
57
+ new (): {
58
+ $slots: S;
59
+ };
60
+ };