From f328ba7d9cb5f93bdeb225b71ccba958bd001c2f Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Wed, 8 May 2024 10:58:27 -0600 Subject: [PATCH] Update config.json.template and index.js with Discord owner, mainGuild, and inviteChannel IDs --- config.json.template | 4 +++- index.js | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/config.json.template b/config.json.template index 3ec2af5..88bec36 100644 --- a/config.json.template +++ b/config.json.template @@ -1,7 +1,9 @@ { "discord": { "token": "YOUR_TOKEN", - "owner": "289884287765839882" + "owner": "your_user_id", + "mainGuild": "your_guild_id", + "inviteChannel": "your_channel_id" }, "ntfy": { "enabled": true, diff --git a/index.js b/index.js index 236471b..91fb056 100644 --- a/index.js +++ b/index.js @@ -377,6 +377,11 @@ discord.on('ready', async () => { "description": "[OWNER ONLY] Setup channels in a category for all rooms", "default_member_permissions": 0, "type": 1 + }, + { + "name": "support", + "description": "Get support for the bot", + "type": 1 } ]; @@ -546,10 +551,8 @@ discord.on("interactionCreate", async (interaction) => { interaction.reply({ embeds, ephemeral: true }); break; case "setupall": - if (!interaction.member.user.id === config.discord.owner) { - interaction.reply({ content: "You are not the bot owner", ephemeral: true }); - return; - }; + if (!config.discord.owner) return interaction.reply({ content: "Owner not set in config", ephemeral: true }); + if (interaction.user.id !== config.discord.owner) return interaction.reply({ content: "You are not the owner", ephemeral: true }); interaction.deferReply({ ephemeral: true }) var category; @@ -594,6 +597,16 @@ discord.on("interactionCreate", async (interaction) => { }); interaction.editReply({ content: "Setup complete", ephemeral: true }); break; + case "support": + // Generate an invite link to the support server (use widget channel) + const invite = await discord.guilds.cache.get(config.discord.mainGuild).channels.cache.get(config.discord.inviteChannel).createInvite(); + const embed = { + title: "Support Server", + description: `Need help with the bot? Join the support server [here](${invite.url})`, + color: 0x00ff00 + } + interaction.reply({ embeds: [embed] }); + break;