From 88dcde4c534e45e9e9a90312c26db9ebf5dac1f7 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Sun, 23 Mar 2025 20:06:13 -0500 Subject: [PATCH] random defaults --- src/webpage/webhooks.ts | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/webpage/webhooks.ts b/src/webpage/webhooks.ts index 76c557f..4437c0a 100644 --- a/src/webpage/webhooks.ts +++ b/src/webpage/webhooks.ts @@ -21,17 +21,24 @@ async function webhookMenu( webhooks.addButtonInput("", I18n.webhooks.newWebHook(), () => { const nameBox = new Dialog(I18n.webhooks.EnterWebhookName()); const options = nameBox.float.options; + const defualts = I18n.webhooks.sillyDefaults().split("\n"); let channel = channelId || moveChannels[0].id; - options.addTextInput(I18n.webhooks.name(), async (name) => { - const json = await ( - await fetch(`${guild.info.api}/channels/${channel}/webhooks/`, { - method: "POST", - headers: guild.headers, - body: JSON.stringify({name}), - }) - ).json(); - makeHook(json); - }); + options.addTextInput( + I18n.webhooks.name(), + async (name) => { + const json = await ( + await fetch(`${guild.info.api}/channels/${channel}/webhooks/`, { + method: "POST", + headers: guild.headers, + body: JSON.stringify({name}), + }) + ).json(); + makeHook(json); + }, + { + initText: defualts[Math.floor(Math.random() * defualts.length)], + }, + ); if (!channelId) { const select = options.addSelect( I18n.webhooks.channel(),