diff --git a/src/content/docs/v3/api/README.md b/src/content/docs/v3/api/README.md index cef9bd57f..0cb348d22 100644 --- a/src/content/docs/v3/api/README.md +++ b/src/content/docs/v3/api/README.md @@ -7,8 +7,8 @@ title: "@sern/handler" ## Namespaces -- [Presence](/v3/api/namespaces/presence/readme/) -- [Sern](/v3/api/namespaces/sern/readme/) +- [Presence](/v3/api/namespacespresence/readme/) +- [Sern](/v3/api/namespacessern/readme/) ## Enumerations diff --git a/src/content/docs/v3/api/functions/Services.md b/src/content/docs/v3/api/functions/Services.md index fc4d07dff..da11a1808 100644 --- a/src/content/docs/v3/api/functions/Services.md +++ b/src/content/docs/v3/api/functions/Services.md @@ -24,7 +24,7 @@ array of dependencies, in the same order of keys provided ## Since 3.0.0 -The plural version of [Service](../../../../../../v3/api/functions/service) +The plural version of [Service](../../../../../../../../v3/api/functions/service) ## Source diff --git a/src/content/docs/v3/api/functions/discordEvent.md b/src/content/docs/v3/api/functions/discordEvent.md index 189b9c942..fd9790fe8 100644 --- a/src/content/docs/v3/api/functions/discordEvent.md +++ b/src/content/docs/v3/api/functions/discordEvent.md @@ -8,7 +8,7 @@ title: "discordEvent" > **discordEvent**\<`T`\>(`mod`): [`EventModule`](/v3/api/type-aliases/eventmodule/) Create event modules from discord.js client events, -This is an [eventModule](../../../../../../v3/api/functions/eventmodule) for discord events, +This is an [eventModule](../../../../../../../../v3/api/functions/eventmodule) for discord events, where typings can be very bad. ## Type parameters diff --git a/src/content/docs/v3/api/namespaces/Presence/README.md b/src/content/docs/v3/api/namespaces/Presence/README.md new file mode 100644 index 000000000..8e38d2898 --- /dev/null +++ b/src/content/docs/v3/api/namespaces/Presence/README.md @@ -0,0 +1,21 @@ +--- +editUrl: false +next: false +prev: false +title: "Presence" +--- + +## Index + +### Interfaces + +- [Result](/v3/api/namespacespresenceinterfaces/result/) + +### Type Aliases + +- [Config](/v3/api/namespacespresencetype-aliases/config/) + +### Functions + +- [module](/v3/api/namespacespresencefunctions/module/) +- [of](/v3/api/namespacespresencefunctions/of/) diff --git a/src/content/docs/v3/api/namespaces/Presence/functions/module.md b/src/content/docs/v3/api/namespaces/Presence/functions/module.md index 2b7a73169..860596eba 100644 --- a/src/content/docs/v3/api/namespaces/Presence/functions/module.md +++ b/src/content/docs/v3/api/namespaces/Presence/functions/module.md @@ -5,7 +5,7 @@ prev: false title: "module" --- -> **module**\<`T`\>(`conf`): [`Config`](/v3/api/namespaces/presence/type-aliases/config/)\<`T`\> +> **module**\<`T`\>(`conf`): [`Config`](/v3/api/namespacespresencetype-aliases/config/)\<`T`\> A small wrapper to provide type inference. Create a Presence module which **MUST** be put in a file called presence.(language-extension) @@ -17,11 +17,11 @@ adjacent to the file where **Sern.init** is CALLED. ## Parameters -• **conf**: [`Config`](/v3/api/namespaces/presence/type-aliases/config/)\<`T`\> +• **conf**: [`Config`](/v3/api/namespacespresencetype-aliases/config/)\<`T`\> ## Returns -[`Config`](/v3/api/namespaces/presence/type-aliases/config/)\<`T`\> +[`Config`](/v3/api/namespacespresencetype-aliases/config/)\<`T`\> ## Source diff --git a/src/content/docs/v3/api/namespaces/Presence/functions/of.md b/src/content/docs/v3/api/namespaces/Presence/functions/of.md index 69a871411..93b7c3483 100644 --- a/src/content/docs/v3/api/namespaces/Presence/functions/of.md +++ b/src/content/docs/v3/api/namespaces/Presence/functions/of.md @@ -13,7 +13,7 @@ Create a Presence body which can be either: ## Parameters -• **root**: `Omit`\<[`Result`](/v3/api/namespaces/presence/interfaces/result/), `"repeat"` \| `"onRepeat"`\> +• **root**: `Omit`\<[`Result`](/v3/api/namespacespresenceinterfaces/result/), `"repeat"` \| `"onRepeat"`\> ## Returns @@ -21,7 +21,7 @@ Create a Presence body which can be either: ### once() -> **once**: () => `Omit`\<[`Result`](/v3/api/namespaces/presence/interfaces/result/), `"repeat"` \| `"onRepeat"`\> +> **once**: () => `Omit`\<[`Result`](/v3/api/namespacespresenceinterfaces/result/), `"repeat"` \| `"onRepeat"`\> #### Example @@ -37,7 +37,7 @@ Presence #### Returns -`Omit`\<[`Result`](/v3/api/namespaces/presence/interfaces/result/), `"repeat"` \| `"onRepeat"`\> +`Omit`\<[`Result`](/v3/api/namespacespresenceinterfaces/result/), `"repeat"` \| `"onRepeat"`\> ### repeated() diff --git a/src/content/docs/v3/api/namespaces/Presence/interfaces/Result.md b/src/content/docs/v3/api/namespaces/Presence/interfaces/Result.md index 7a06246e3..e744894b0 100644 --- a/src/content/docs/v3/api/namespaces/Presence/interfaces/Result.md +++ b/src/content/docs/v3/api/namespaces/Presence/interfaces/Result.md @@ -29,15 +29,15 @@ title: "Result" ### onRepeat()? -> `optional` **onRepeat**: (`previous`) => [`Result`](/v3/api/namespaces/presence/interfaces/result/) +> `optional` **onRepeat**: (`previous`) => [`Result`](/v3/api/namespacespresenceinterfaces/result/) #### Parameters -• **previous**: [`Result`](/v3/api/namespaces/presence/interfaces/result/) +• **previous**: [`Result`](/v3/api/namespacespresenceinterfaces/result/) #### Returns -[`Result`](/v3/api/namespaces/presence/interfaces/result/) +[`Result`](/v3/api/namespacespresenceinterfaces/result/) #### Source diff --git a/src/content/docs/v3/api/namespaces/Presence/type-aliases/Config.md b/src/content/docs/v3/api/namespaces/Presence/type-aliases/Config.md index eb43cec90..4a67aa219 100644 --- a/src/content/docs/v3/api/namespaces/Presence/type-aliases/Config.md +++ b/src/content/docs/v3/api/namespaces/Presence/type-aliases/Config.md @@ -15,7 +15,7 @@ title: "Config" ### execute() -> **execute**: (...`v`) => [`Result`](/v3/api/namespaces/presence/interfaces/result/) +> **execute**: (...`v`) => [`Result`](/v3/api/namespacespresenceinterfaces/result/) #### Parameters @@ -23,7 +23,7 @@ title: "Config" #### Returns -[`Result`](/v3/api/namespaces/presence/interfaces/result/) +[`Result`](/v3/api/namespacespresenceinterfaces/result/) ### inject? diff --git a/src/content/docs/v3/api/namespaces/Sern/README.md b/src/content/docs/v3/api/namespaces/Sern/README.md new file mode 100644 index 000000000..fc90b3f6b --- /dev/null +++ b/src/content/docs/v3/api/namespaces/Sern/README.md @@ -0,0 +1,12 @@ +--- +editUrl: false +next: false +prev: false +title: "Sern" +--- + +## Index + +### Functions + +- [init](/v3/api/namespacessernfunctions/init/) diff --git a/src/content/docs/v3/api/type-aliases/SernOptionsData.md b/src/content/docs/v3/api/type-aliases/SernOptionsData.md index a38e7fe9d..efd12c0a1 100644 --- a/src/content/docs/v3/api/type-aliases/SernOptionsData.md +++ b/src/content/docs/v3/api/type-aliases/SernOptionsData.md @@ -7,7 +7,7 @@ title: "SernOptionsData" > **SernOptionsData**: [`SernSubCommandData`](/v3/api/interfaces/sernsubcommanddata/) \| [`SernSubCommandGroupData`](/v3/api/interfaces/sernsubcommandgroupdata/) \| `APIApplicationCommandBasicOption` \| [`SernAutocompleteData`](/v3/api/interfaces/sernautocompletedata/) -Type that replaces autocomplete with [SernAutocompleteData](../../../../../../v3/api/interfaces/sernautocompletedata) +Type that replaces autocomplete with [SernAutocompleteData](../../../../../../../../v3/api/interfaces/sernautocompletedata) ## Source diff --git a/src/content/docs/v4/reference/modules.mdx b/src/content/docs/v4/reference/modules.mdx index 0bfca7db5..00068d016 100644 --- a/src/content/docs/v4/reference/modules.mdx +++ b/src/content/docs/v4/reference/modules.mdx @@ -8,7 +8,7 @@ sern operates with modules. At its core, Modules contain a `type` field and `exe executing. ### Modules -we'll walk you through creating your first command module. +We'll walk you through creating your first command module. If you installed a new project via the CLI, your file should be here: @@ -36,6 +36,9 @@ export default commandModule({ Run `sern commands publish` so discord registers it to your application correctly. ::: + +import { Tabs, TabItem } from '@astrojs/starlight/components'; + ## Modal So, lets say you want to make a command module that listens to modals. @@ -43,17 +46,50 @@ So, lets say you want to make a command module that listens to modals. Keep in mind, you'll need to send a modal with a custom id of `dm-me`. This example below is the response to a modal being sent. ::: -```js title=src/commands/dm-me.js -import { CommandType, commandModule } from "@sern/handler"; -export default commandModule({ - type: CommandType.Modal, - async execute(modal) { - const value = modal.fields.getTextInputValue("message"); - modal.client.users - .fetch("182326315813306368") - .then(usr => usr.send(value + ` from ${modal.user}`)); - modal.reply({ ephemeral: true, content: "Sent" }); - }, -}); -``` + + + ```js title="src/commands/ping.js" + import { CommandType, commandModule } from "@sern/handler"; + import { ModalBuilder, ActionRowBuilder } from 'discord.js'; + export default commandModule({ + type: CommandType.Slash, + description: "A ping command", + execute: async (ctx, sdt) => { + const modal = new ModalBuilder() + .setCustomId('dm-me') + .setTitle('My Modal'); + + const hobbiesInput = new TextInputBuilder() + .setCustomId('dmmsg') + .setLabel("What do you want to send to me") + .setStyle(TextInputStyle.Paragraph); + + // An action row only holds one text input, + const row = new ActionRowBuilder().addComponents(hobbiesInput); + + // Add inputs to the modal + modal.addComponents(row); + await ctx.interaction.showModal(modal); + await ctx.reply("Pong 🏓"); + }, + }); + ``` + + + ```ts title="src/commands/dm-me.js" + import { CommandType, commandModule } from "@sern/handler"; + + export default commandModule({ + type: CommandType.Modal, + async execute(modal) { + const value = modal.fields.getTextInputValue("message"); + modal.client.users + .fetch("182326315813306368") + .then(usr => usr.send(value + ` from ${modal.user}`)); + modal.reply({ ephemeral: true, content: "Sent" }); + }, + }); + ``` + +