diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts index 2f20d2e..e0d8d8d 100644 --- a/src/commands/nucleus/premium.ts +++ b/src/commands/nucleus/premium.ts @@ -9,7 +9,7 @@ const command = (builder: SlashCommandSubcommandBuilder) => const callback = async (interaction: CommandInteraction): Promise => { await interaction.reply({embeds: LoadingEmbed, ephemeral: true}) - const member = await (await interaction.client.guilds.fetch("684492926528651336")).members.fetch(interaction.user.id) + const member = (await interaction.client.guilds.fetch("684492926528651336")).members.cache.get(interaction.user.id) const firstDescription = "\n\nPremium allows your server to get access to extra features, for a fixed price per month.\nThis includes:\n" + "- Attachment logs - Stores attachments so they can be viewed after a message is deleted.\n" + "- Ticket Transcripts - Gives a link to view the history of a ticket after it has been closed.\n" diff --git a/src/commands/settings/tracks.ts b/src/commands/settings/tracks.ts index 612d069..8d2d59d 100644 --- a/src/commands/settings/tracks.ts +++ b/src/commands/settings/tracks.ts @@ -152,7 +152,7 @@ const editTrack = async (interaction: ButtonInteraction | StringSelectMenuIntera let closed = false; do { const editableRoles: string[] = current.track.map((r) => { - if(!(roles.get(r)!.position >= (interaction.member as GuildMember).roles.highest.position)) return roles.get(r)!.name; + if(!(roles.get(r)!.position >= (interaction.member as GuildMember).roles.highest.position) || interaction.user.id === interaction.guild?.ownerId) return roles.get(r)!.name; }).filter(v => v !== undefined) as string[]; const selectMenu = new ActionRowBuilder() .addComponents( @@ -217,7 +217,10 @@ const editTrack = async (interaction: ButtonInteraction | StringSelectMenuIntera ) .setStatus("Success") - interaction.editReply({embeds: [embed], components: [roleSelect, selectMenu, buttons]}); + let comps: ActionRowBuilder[] = [roleSelect, buttons]; + if(current.track.length >= 1) comps.splice(1, 0, selectMenu); + + interaction.editReply({embeds: [embed], components: comps}); let out: ButtonInteraction | RoleSelectMenuInteraction | StringSelectMenuInteraction | null; @@ -233,9 +236,9 @@ const editTrack = async (interaction: ButtonInteraction | StringSelectMenuIntera if(!out) return; if (out.isButton()) { - out.deferUpdate(); switch(out.customId) { case "back": { + out.deferUpdate(); closed = true; break; } @@ -244,14 +247,17 @@ const editTrack = async (interaction: ButtonInteraction | StringSelectMenuIntera break; } case "reorder": { + out.deferUpdate(); current.track = (await reorderTracks(out, message, roles, current.track))!; break; } case "retainPrevious": { + out.deferUpdate(); current.retainPrevious = !current.retainPrevious; break; } case "nullable": { + out.deferUpdate(); current.nullable = !current.nullable; break; } @@ -271,8 +277,9 @@ const editTrack = async (interaction: ButtonInteraction | StringSelectMenuIntera const role = out.values![0]!; if(!current.track.includes(role)) { current.track.push(role); + } else { + out.reply({content: "That role is already on this track", ephemeral: true}) } - out.reply({content: "That role is already on this track", ephemeral: true}) break; } } @@ -330,7 +337,7 @@ const callback = async (interaction: CommandInteraction) => { .setCustomId("next") .setEmoji(getEmojiByName("CONTROL.RIGHT", "id") as APIMessageComponentEmoji) .setStyle(ButtonStyle.Primary) - .setDisabled(page === Object.keys(tracks).length - 1), + .setDisabled(page === tracks.length - 1), new ButtonBuilder() .setCustomId("add") .setLabel("New Track") diff --git a/src/index.ts b/src/index.ts index a3a8d38..306ca50 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,6 +13,9 @@ client.on("ready", async () => { } else { client.fetchedCommands = await client.application?.commands.fetch()!; } + setInterval(async () => { + await client.database.premium.checkAllPremium(); + }, 1000 * 60 * 3); }); process.on("unhandledRejection", (err) => { console.error(err) }); process.on("uncaughtException", (err) => { console.error(err) }); diff --git a/src/utils/commandRegistration/register.ts b/src/utils/commandRegistration/register.ts index 0ff04b3..693ad00 100644 --- a/src/utils/commandRegistration/register.ts +++ b/src/utils/commandRegistration/register.ts @@ -214,6 +214,8 @@ export default async function register() { await guild.commands.set(commandList); } else { console.log(`${colors.blue}Registering commands in production mode${colors.none}`) + const guild = await client.guilds.fetch(config.developmentGuildID); + await guild.commands.set([]); await client.application?.commands.set(commandList); } }