diff --git a/bun.lockb b/bun.lockb
index 9da7931..cf3a7e4 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index f348d58..3127c7e 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,7 @@
"@lilybird/jsx": "0.2.0",
"@lilybird/transformers": "^0.2.0",
"@paperdave/logger": "^3.0.1",
+ "@purplet/serialize": "^2.0.0",
"@wolfram-alpha/wolfram-alpha-api": "^23.1004.144821-RELEASE",
"algoliasearch": "^4.23.2",
"bun-tracestrings": "github:oven-sh/bun.report",
diff --git a/src/commands/ping.tsx b/src/commands/ping.tsx
index bfcb5ab..dc93b43 100644
--- a/src/commands/ping.tsx
+++ b/src/commands/ping.tsx
@@ -1,6 +1,12 @@
-import { ApplicationCommand as JSXApplicationCommand } from "@lilybird/jsx";
+import {
+ ActionRow,
+ Button,
+ ApplicationCommand as JSXApplicationCommand,
+} from "@lilybird/jsx";
import { ApplicationCommand } from "@lilybird/handlers";
+import { serializers as S } from "@purplet/serialize";
import { possibleClosedForm } from "../util.ts";
+import { ButtonStyle } from "lilybird";
export default {
post: "GLOBAL",
@@ -15,12 +21,29 @@ export default {
possibleClosedForm(rest),
]);
+ const serialized = S.generic.encodeCustomId([
+ ws,
+ wsClosedForm,
+ rest,
+ restClosedForm,
+ ]);
+
await interaction.editReply({
content: [
`🏓`,
`WebSocket: \`${wsClosedForm} ms\``,
`Rest: \`${restClosedForm} ms\``,
].join("\n"),
+ components: [
+
+
+ ,
+ ],
});
},
} satisfies ApplicationCommand;
diff --git a/src/listeners/interaction_create.ts b/src/listeners/interaction_create.ts
new file mode 100644
index 0000000..9ea39e9
--- /dev/null
+++ b/src/listeners/interaction_create.ts
@@ -0,0 +1,42 @@
+import { Event } from "@lilybird/handlers";
+import { serializers as S } from "@purplet/serialize";
+import { silently } from "src/util.ts";
+
+export default {
+ event: "interactionCreate",
+ run: (interaction) => {
+ if (
+ !interaction.isMessageComponentInteraction() ||
+ !interaction.data.isButton()
+ )
+ return;
+
+ const id = interaction.data.id;
+
+ if (id?.[0] == "0" && id?.[1] == "-") {
+ const combined = interaction.data.id.split("-")?.[1];
+ if (!combined) return;
+
+ const [ws, wsClosedForm, rest, restClosedForm] =
+ S.generic.decodeCustomId(combined);
+
+ silently(
+ interaction.reply({
+ content: [
+ `🏓`,
+ "**WebSocket:**",
+ `\`${wsClosedForm}\``,
+ `\`≈ ${ws} ms\``,
+ "",
+ "**Rest:**",
+ `\`${restClosedForm}\``,
+ `\`≈ ${rest} ms\``,
+ "",
+ "Mathematics is the language of the universe, it's truly fascinating! And being a software engineer requires a deep understanding of this language. It's not an easy field, but it's incredibly rewarding. 😄",
+ ].join("\n"),
+ ephemeral: true,
+ })
+ );
+ }
+ },
+} satisfies Event<"interactionCreate">;
diff --git a/src/message-commands/ping.ts b/src/message-commands/ping.tsx
similarity index 54%
rename from src/message-commands/ping.ts
rename to src/message-commands/ping.tsx
index ff54f49..478b4ff 100644
--- a/src/message-commands/ping.ts
+++ b/src/message-commands/ping.tsx
@@ -1,5 +1,8 @@
+import { serializers as S } from "@purplet/serialize";
import { MessageCommand } from "@lilybird/handlers";
+import { ActionRow, Button } from "@lilybird/jsx";
import { possibleClosedForm } from "../util.ts";
+import { ButtonStyle } from "lilybird";
export default {
name: "ping",
@@ -15,12 +18,29 @@ export default {
possibleClosedForm(rest),
]);
+ const serialized = S.generic.encodeCustomId([
+ ws,
+ wsClosedForm,
+ rest,
+ restClosedForm,
+ ]);
+
await newMessage.edit({
content: [
`🏓`,
`WebSocket: \`${wsClosedForm} ms\``,
`Rest: \`${restClosedForm} ms\``,
].join("\n"),
+ components: [
+
+
+ ,
+ ],
});
},
} satisfies MessageCommand;