From d8614afdf97460b9636911f000deaa5879d46e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Mon, 13 May 2024 22:34:25 +0200 Subject: [PATCH] feat(ping): implement button for normal people --- bun.lockb | Bin 18915 -> 19311 bytes package.json | 1 + src/commands/ping.tsx | 25 +++++++++++- src/listeners/interaction_create.ts | 42 +++++++++++++++++++++ src/message-commands/{ping.ts => ping.tsx} | 20 ++++++++++ 5 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 src/listeners/interaction_create.ts rename src/message-commands/{ping.ts => ping.tsx} (54%) diff --git a/bun.lockb b/bun.lockb index 9da793183234ddccd4a6bc4e1b04b39a41d2c0be..cf3a7e46baa62d675e2007d1e433741352b87d2e 100755 GIT binary patch delta 2936 zcmc&$d2Ezb5dYq{+tS^3TZ$ZAdM&g-x3XV%x5sW<=yJ7%ZaE6pRWXGk1y>5x7Pa;2 zN+Ku(Z5ad7h+w!8g1SZ#FA|if92yB;qyfQ5+k`8c7%%WQ@9Wws{^LJ7$-Ljpn|I92 zd-J{T0*NadM4M*+z-!5>vgQXr+m!oe`@x;}&)M&3Z25BIH@5RHuUhlr?^S0j6iGSl zf%M5gXu6`e35pV`57xIV2sSS4L{}{9LQw_+Yk={S zW*ARk5)a-5v;dDqDav5r2A~yK2pkG*H!8{y-~s3S57Edkj9+CaA|yA|55X(HHdr@;Zea#$wY@WV8Siqv@K#BPyxe=o6dC z9_164C>Z54RUyf2H_|nuN35o9SUw?pba_%VqULDejHH3kheM}YLlSK@#E5L#6YYyS zi)>A${n5oyW1H@m14gRxj+_rc_BNPoyzOg^MSm8 z7t9+Mfq7hUFCtaaj&#aEkYuTs_1epUOnr#`IbuJU7pep^{S)$rGoFM+Ud2JTD1npKTv<0XO+Gd+yIH=ne5E@M!@vAr+9zW8fQiEYI zzIeuPbLQhFI+y4&dvo+~Ds$Fr<5D4Czo8R%YvAVI0Zu2~u2rPsyCm=E93U6NRPZz~ zz8*>$y{i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7e 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: [ + +