From 9fb2eacc67bb2222f7e02817887905140b98da6a Mon Sep 17 00:00:00 2001 From: rxdn <29165304+rxdn@users.noreply.github.com> Date: Thu, 24 Dec 2020 23:21:40 +0000 Subject: [PATCH] Add interactions url --- .../whitelabelcreateinteractions.go | 2 ++ public/templates/views/whitelabel.tmpl | 27 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/http/endpoints/api/whitelabel/whitelabelcreateinteractions.go b/app/http/endpoints/api/whitelabel/whitelabelcreateinteractions.go index 088f4cf..205c70c 100644 --- a/app/http/endpoints/api/whitelabel/whitelabelcreateinteractions.go +++ b/app/http/endpoints/api/whitelabel/whitelabelcreateinteractions.go @@ -12,6 +12,8 @@ import ( func WhitelabelCreateInteractions(ctx *gin.Context) { userId := ctx.Keys["userid"].(uint64) + //TODO: COOLDOWN + // Get bot bot, err := database.Client.Whitelabel.GetByUserId(userId) if err != nil { diff --git a/public/templates/views/whitelabel.tmpl b/public/templates/views/whitelabel.tmpl index c1a9305..773daad 100644 --- a/public/templates/views/whitelabel.tmpl +++ b/public/templates/views/whitelabel.tmpl @@ -54,8 +54,15 @@
+
+ + +
+
+
+
@@ -64,7 +71,7 @@
- @@ -159,7 +166,7 @@ return; } - const inviteUrl = 'https://discord.com/oauth2/authorize?client_id=' + res.data.id + '&scope=bot&permissions=805825648'; + const inviteUrl = 'https://discord.com/oauth2/authorize?client_id=' + res.data.id + '&scope=bot+applications.commands&permissions=805825648'; window.open(inviteUrl, '_blank'); }, false); @@ -177,6 +184,7 @@ return; } + await loadInteractionUrl(); notifySuccess(`Started tickets whitelabel on ${res.data.bot.username}#${res.data.bot.discriminator}`); } @@ -257,6 +265,20 @@ document.getElementById('public-key').value = key; } + async function loadInteractionUrl() { + const res = await axios.get('/user/whitelabel'); + if (res.status === 404) { + return; + } + + if (res.status !== 200 || !res.data.success) { + notifyError(res.data.error); + return; + } + + document.getElementById('interaction-url').value = 'https://gateway.ticketsbot.net/handle/' + res.data.id; + } + async function createSlashCommands() { notify('Slash Commands', 'Creating slash commands, please note this may take up to 120 seconds to complete'); @@ -276,6 +298,7 @@ withLoadingScreen(async () => { await loadStatus(); await loadErrors(); + await loadInteractionUrl(); await loadPublicKey(); });