From b9e522862650788f0082425e373437fba295d54e Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sat, 7 Oct 2023 22:31:53 -0600 Subject: [PATCH] utility.appinfo: fix setting invite url for non-public --- src/modules/utility.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/modules/utility.js b/src/modules/utility.js index a8c4e52..311e13d 100644 --- a/src/modules/utility.js +++ b/src/modules/utility.js @@ -1536,21 +1536,23 @@ appinfo.callback = async function (msg, line) { }); } - if ( - (app.bot_public != null && !app.bot_require_code_grant) || - (app.integration_public != null && !app.integration_require_code_grant) - ) { - let scope = "bot"; - let permissions = ""; - if (app.install_params) { - if (app.install_params.scopes) { - scope = app.install_params.scopes.join("+"); - } - if (app.install_params.permissions) { - permissions = "&permissions=" + app.install_params.permissions; + if (app.bot_public != null || app.integration_public != null) { + if ( + (app.bot_public && !app.bot_require_code_grant) || + (app.integration_public && !app.integration_require_code_grant) + ) { + let scope = "bot"; + let permissions = ""; + if (app.install_params) { + if (app.install_params.scopes) { + scope = app.install_params.scopes.join("+"); + } + if (app.install_params.permissions) { + permissions = "&permissions=" + app.install_params.permissions; + } } + embed.url = `https://discord.com/oauth2/authorize?client_id=${app.id}&scope=${scope}${permissions}`; } - embed.url = `https://discord.com/oauth2/authorize?client_id=${app.id}&scope=${scope}${permissions}`; try { const bot = await hf.bot.requestHandler.request(