From 85ecc72418d415bbfbc9e7fee1501865dfe4e6c5 Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Mon, 3 Jun 2024 00:02:18 -0500 Subject: [PATCH] making website look better --- astro.config.mjs | 4 ++ src/content/docs/v4/reference/plugins.mdx | 2 +- src/content/docs/v4/snippets/event.mdx | 2 +- src/content/docs/v4/transition/from-v3.mdx | 46 ++++++++++++++++++++ src/content/docs/v4/transition/whats-new.mdx | 10 +++++ src/pages/plugins.astro | 3 ++ 6 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 src/content/docs/v4/transition/from-v3.mdx create mode 100644 src/content/docs/v4/transition/whats-new.mdx diff --git a/astro.config.mjs b/astro.config.mjs index 608954bc2..0c629ea79 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -95,6 +95,10 @@ export default defineConfig({ label: "Snippets", autogenerate: { directory: "v4/snippets" }, }, + { + label: "Transition", + autogenerate: { directory: "v4/transition" }, + }, ], }, ], diff --git a/src/content/docs/v4/reference/plugins.mdx b/src/content/docs/v4/reference/plugins.mdx index 7d6c60b48..bfb8c0a7a 100644 --- a/src/content/docs/v4/reference/plugins.mdx +++ b/src/content/docs/v4/reference/plugins.mdx @@ -141,7 +141,7 @@ export default commandModule({ type: CommandType.Slash, plugins: [plugin, plugin2], execute: (ctx, sdt) => { - console.log(sdt.state) // { a: 'from plugin1', b: '182326315813306368 from plugin2' } + sdt.state // { a: 'from plugin1', b: '182326315813306368 from plugin2' } } }) ``` diff --git a/src/content/docs/v4/snippets/event.mdx b/src/content/docs/v4/snippets/event.mdx index beb7ba024..6604db7b1 100644 --- a/src/content/docs/v4/snippets/event.mdx +++ b/src/content/docs/v4/snippets/event.mdx @@ -16,7 +16,7 @@ import { Tabs, TabItem } from '@astrojs/starlight/components'; export default eventModule({ type: EventType.Discord, name: "guildMemberAdd", - async execute(member: GuildMember) { + async execute(member) { }, }); ``` diff --git a/src/content/docs/v4/transition/from-v3.mdx b/src/content/docs/v4/transition/from-v3.mdx new file mode 100644 index 000000000..5e67f27f2 --- /dev/null +++ b/src/content/docs/v4/transition/from-v3.mdx @@ -0,0 +1,46 @@ +--- +title: Updating your sern app +description: Moving from version three to four +sidebar: + order: 1 +--- + +## Arguments changed for all commands. +> The second argument is the `new SDT` type + +```ts {7-10} +import { commandModule, CommandType } from '@sern/handler' + +export default commandModule({ + type: CommandType.Slash, + description: "My ping command", + execute: (ctx, sdt) => { + sdt.params // only exists if current command is not a component + sdt.deps // Dependencies + sdt.type // module type + } +}) +``` +:::tip +To access arguments now, use `ctx.options`. +This getter will return `string[]` if `ctx` is a `Message`, else the discord.js interaction resolver +::: + +It used to look like this: +```ts {7-8} +import { commandModule, CommandType } from '@sern/handler' + +export default commandModule({ + type: CommandType.Slash, + description: "My ping command", + execute: (ctx, [type, opts]) => { + type // 'text' | 'slash' + opts // string[] | discord.js command option resolver + } +}) +``` +## Killing Experimental Things +> *Sometimes your experiments need to be put behind the barn.* + +`Sern.init('file')` has been removed. + diff --git a/src/content/docs/v4/transition/whats-new.mdx b/src/content/docs/v4/transition/whats-new.mdx new file mode 100644 index 000000000..7465145be --- /dev/null +++ b/src/content/docs/v4/transition/whats-new.mdx @@ -0,0 +1,10 @@ +--- +title: What's New +description: YEAHHHHHH NEW STUFF +sidebar: + order: 1 +--- +- [SDT](/v4/reference/plugins#passing-state-with-sdt) +- Cron Modules +- [Cross-component data](/v4/reference/modules/#dynamic-component-parameters) +- updating the module diff --git a/src/pages/plugins.astro b/src/pages/plugins.astro index b2d222434..c29a2b8f1 100644 --- a/src/pages/plugins.astro +++ b/src/pages/plugins.astro @@ -20,6 +20,9 @@ const plugins = pluginResponse.value; --- +
+ First time here? View plugins +
{plugins.map((p) => )}