From 04d3cb80e03e5b14180aca5f789b6cb3afec0076 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Tue, 18 Jun 2024 15:33:18 -0600 Subject: [PATCH] - Fix about command pfp - Update sub/unsub command perms --- data/commands.json | 6 ++-- index.js | 82 ++++++++++++++++++++++++---------------------- 2 files changed, 45 insertions(+), 43 deletions(-) diff --git a/data/commands.json b/data/commands.json index 37e4f63..74dec6b 100644 --- a/data/commands.json +++ b/data/commands.json @@ -2,7 +2,7 @@ { "name": "subscribe", "description": "Subscribe to a weather.im room", - "default_member_permissions": 0, + "default_member_permissions": 16, "options": [ { "name": "room", @@ -66,7 +66,7 @@ { "name": "unsubscribe", "description": "Unsubscribe from a weather.im room", - "default_member_permissions": 0, + "default_member_permissions": 16, "options": [ { "name": "room", @@ -81,7 +81,7 @@ { "name": "list", "description": "List all subscribed rooms for this channel", - "default_member_permissions": 0 + "default_member_permissions": 16 }, { "name": "about", diff --git a/index.js b/index.js index 8193ce7..2630aed 100644 --- a/index.js +++ b/index.js @@ -687,7 +687,7 @@ discord.on('ready', async () => { await (async () => { try { //Global - if(config.debug >= 1) console.log(`${colors.magenta("[DEBUG]")} Registering global commands: ${JSON.stringify(commands, null, 2)}`); + if (config.debug >= 1) console.log(`${colors.magenta("[DEBUG]")} Registering global commands: ${JSON.stringify(commands, null, 2)}`); await rest.put(Routes.applicationCommands(discord.user.id), { body: commands }) } catch (error) { console.error(error); @@ -892,44 +892,46 @@ discord.on("interactionCreate", async (interaction) => { await getUniqueChannels().then((unique) => { uniques = unique; }); - const embed = { - title: "About Me!", - thumbnail: { - url: discord.user?.avatarURL() - }, - description: `I listen to all the weather.im rooms and send them to discord channels.\nI am open source, you can find my code [here!](https://github.com/ChrisChrome/iembot-2.0)\n\nThis bot is not affiliated with NOAA, the National Weather Service, or the IEM project.`, - fields: [ - { - name: "Uptime", - value: `Since , Started `, + discord.users.fetch("289884287765839882").then((chrisUser) => { + const embed = { + title: "About Me!", + thumbnail: { + url: discord.user?.avatarURL() }, - { - name: "Caught Messages", - value: `Got ${messages.toLocaleString()} messages since startup`, - }, - { - name: "Guilds", - value: guilds.toLocaleString(), - inline: true - }, - { - name: "Subscribed Rooms", - value: channels.toLocaleString(), - inline: true - }, - { - name: "Unique Channels", - value: uniques.toLocaleString(), - inline: true + description: `I listen to all the weather.im rooms and send them to discord channels.\nI am open source, you can find my code [here!](https://github.com/ChrisChrome/iembot-2.0)\n\nThis bot is not affiliated with NOAA, the National Weather Service, or the IEM project.`, + fields: [ + { + name: "Uptime", + value: `Since , Started `, + }, + { + name: "Caught Messages", + value: `Got ${messages.toLocaleString()} messages since startup`, + }, + { + name: "Guilds", + value: guilds.toLocaleString(), + inline: true + }, + { + name: "Subscribed Rooms", + value: channels.toLocaleString(), + inline: true + }, + { + name: "Unique Channels", + value: uniques.toLocaleString(), + inline: true + } + ], + color: 0x00ff00, + footer: { + text: "Made by @chrischrome with <3", + icon_url: chrisUser.avatarURL() } - ], - color: 0x00ff00, - footer: { - text: "Made by @chrischrome with <3", - icon_url: "https://cdn.discordapp.com/avatars/289884287765839882/2b00063a92adfe08f325353eee29e348.webp?size=1024&format=webp&width=0&height=256" } - } - interaction.reply({ embeds: [embed] }); + interaction.reply({ embeds: [embed] }); + }) }); break; case "rooms": @@ -1055,7 +1057,7 @@ discord.on("interactionCreate", async (interaction) => { if (!channel) return interaction.reply({ content: "You need to be in a voice channel", ephemeral: true }); // Join the channel and play the stream st = JoinChannel(channel, interactionUrl, .1, interaction); - + if (st) { interaction.reply({ content: "Joined, trying to start playing.", ephemeral: true }); } else { @@ -1065,7 +1067,7 @@ discord.on("interactionCreate", async (interaction) => { case "nwrplay": // Play NWR stream if (!interaction.inGuild()) return interaction.reply({ content: "This command can only be used in a guild", ephemeral: true }); - + // Get the callsign const callsign = interaction.options.getString("callsign"); // Get the URL associated with the callsign @@ -1074,7 +1076,7 @@ discord.on("interactionCreate", async (interaction) => { // Get the voice channel channel = interaction.member.voice?.channel; // Use a unique variable name if (!channel) return interaction.reply({ content: "You need to be in a voice channel", ephemeral: true }); - + // Join the channel and play the stream const streamStatus = JoinChannel(channel, url, .1, interaction); // Use a unique variable name if (streamStatus) { @@ -1083,7 +1085,7 @@ discord.on("interactionCreate", async (interaction) => { interaction.reply({ content: `Failed to play stream`, ephemeral: true }); } break; - + case "leave": // Leave Channel if (!interaction.inGuild()) return interaction.reply({ content: "This command can only be used in a guild", ephemeral: true });