pull/11/head
TheCodedProf 3 years ago
parent 4e0b325fe2
commit d0a166dfaa

@ -9,7 +9,7 @@ const command = (builder: SlashCommandSubcommandBuilder) =>
const callback = async (interaction: CommandInteraction): Promise<void> => {
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"

@ -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<StringSelectMenuBuilder>()
.addComponents(
@ -217,7 +217,10 @@ const editTrack = async (interaction: ButtonInteraction | StringSelectMenuIntera
)
.setStatus("Success")
interaction.editReply({embeds: [embed], components: [roleSelect, selectMenu, buttons]});
let comps: ActionRowBuilder<RoleSelectMenuBuilder | ButtonBuilder | StringSelectMenuBuilder>[] = [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")

@ -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) });

@ -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);
}
}

Loading…
Cancel
Save