export default { name: 'status_role', description: 'Give a role to a user when they meet custom status requirements.', type: 1, permissions: { user: ['ManageGuild'], client: ['EmbedLinks', 'ReadMessageHistory', 'SendMessages', 'UseExternalEmojis', 'ViewChannel', 'AttachFiles'], }, run: async (client, interaction: ChatInputCommandInteraction) => { statusRoleHandlerExtended('menu'); }, } as SlashCommandsType; async function statusRoleHandlerExtended(page: string, { client, interaction, i18n, slashData }: ExtendedHandlerOptions<'statusRole'>): Promise { switch (page) { case 'menu': { await quickCollector(interaction, i18n, { content: getAd(globalPerms), embeds: [{ title: i18n.get('menu.title', { number: slashData.data.monitor }), description: '> ' + i18n.get('menu.description') + '\n\n' + Object.values(descOptions).join('\n'), color: client.config?.embed.base_color, thumbnail: { url: client.user?.displayAvatarURL() as string }, footer: { text: i18n.get('save_note', true) }, }], components: [{ type: ComponentType.ActionRow, components: [{ type: ComponentType.Button, label: i18n.get('configure.text'), style: ButtonStyle.Primary, custom_id: 'texts', emoji: getEmojiCheck('main.icons_edit', true, true), }], }], }, async (click) => { if (click === 1) return; if (!click) return errorHandlerMenu(client, interaction, i18n); switch (click.customId) { case 'texts': { statusRoleHandlerExtended('menu', { client, interaction, i18n, slashData }); // go back and make menu interactible(?) again quickModal(click, { title: i18n.get('words.texts', true), custom_id: 'texts_modal', components: [{ type: 1, components: [{ type: 4, custom_id: 'note', label: i18n.get('words.note', true) + '..', style: 2, value: i18n.get('configure.texts_note'), placeholder: i18n.get('configure.texts_note'), required: false, }], }], }, async (modal) => { if (modal) { modal.deferUpdate().catch(() => null); try { const texts = modal.fields.getTextInputValue('texts'); // update some variable statusRoleHandlerExtended('menu', { client, interaction, i18n, slashData }); } catch { // * } } }); break; } } }); break; } } }