PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 1 | import { LoadingEmbed, Embed } from "../../utils/defaults.js"; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 2 | import Discord, { |
| 3 | CommandInteraction, |
| 4 | GuildMember, |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 5 | ActionRowBuilder, |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 6 | ButtonBuilder, |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 7 | MessageComponentInteraction, |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 8 | ButtonStyle, |
| 9 | PermissionResolvable, |
| 10 | APISelectMenuOption, |
| 11 | StringSelectMenuBuilder |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 12 | } from "discord.js"; |
PineaFan | 100df68 | 2023-01-02 13:26:08 +0000 | [diff] [blame] | 13 | import type { SlashCommandSubcommandBuilder } from "@discordjs/builders"; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 14 | import EmojiEmbed from "../../utils/generateEmojiEmbed.js"; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 15 | import getEmojiByName from "../../utils/getEmojiByName.js"; |
| 16 | import generateKeyValueList from "../../utils/generateKeyValueList.js"; |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 17 | import createPageIndicator from "../../utils/createPageIndicator.js"; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 18 | import client from "../../utils/client.js"; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 19 | |
| 20 | const command = (builder: SlashCommandSubcommandBuilder) => |
| 21 | builder |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 22 | .setName("about") |
| 23 | .setDescription("Shows info about a user") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 24 | .addUserOption((option) => |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 25 | option.setName("user").setDescription("The user to get info about | Default: Yourself") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 26 | ); |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 27 | |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 28 | const callback = async (interaction: CommandInteraction): Promise<void> => { |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 29 | const guild = interaction.guild!; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 30 | const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 31 | await userAbout(guild, member, interaction); |
| 32 | } |
| 33 | |
| 34 | async function userAbout(guild: Discord.Guild, member: Discord.GuildMember, interaction: Discord.CommandInteraction | Discord.ContextMenuCommandInteraction) { |
| 35 | await member.user.fetch() |
| 36 | await member.fetch() |
| 37 | await interaction.reply({ |
| 38 | embeds: LoadingEmbed, |
| 39 | fetchReply: true, |
| 40 | ephemeral: true |
| 41 | }); |
| 42 | const { renderUser, renderDelta } = client.logger; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 43 | const flags: string[] = []; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 44 | if ( |
| 45 | [ |
| 46 | "438733159748599813", // Pinea |
| 47 | "317731855317336067", // Mini |
| 48 | "261900651230003201", // Coded |
| 49 | "511655498676699136" // Zan |
| 50 | ].includes(member.user.id) |
| 51 | ) { |
| 52 | flags.push("NUCLEUSDEVELOPER"); |
| 53 | } |
| 54 | if ( |
| 55 | (await client.guilds.cache.get("684492926528651336")?.members.fetch()) |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 56 | ?.filter((m: GuildMember) => m.roles.cache.has("760896837866749972")) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 57 | ?.map((m: GuildMember) => m.id) |
| 58 | .includes(member.user.id) |
| 59 | ) { |
| 60 | flags.push("CLICKSDEVELOPER"); |
| 61 | } |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 62 | if (member.user.flags) { member.user.flags.toArray().map((flag) => { flags.push(flag.toString()); }); } |
| 63 | if (member.user.bot) { flags.push("BOT"); } |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 64 | // Check if they are boosting the server |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 65 | if (member.premiumSince) { flags.push("BOOSTER"); } |
| 66 | const nameReplacements: Record<string, string> = { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 67 | NUCLEUSDEVELOPER: "**Nucleus Developer**", |
| 68 | CLICKSDEVELOPER: "Clicks Developer", |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 69 | BOT: "Bot", |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 70 | BOOSTER: "Server Booster", |
| 71 | HypeSquadOnlineHouse1: "Hypesquad Bravery", |
| 72 | HypeSquadOnlineHouse2: "Hypesquad Brilliance", |
| 73 | HypeSquadOnlineHouse3: "Hypesquad Balance", |
| 74 | Hypesquad: "Hypesquad Events", |
| 75 | PremiumEarlySupporter: "Early Supporter", |
| 76 | BugHunterLevel1: "Bug Hunter Level 1", |
| 77 | BugHunterLevel2: "Bug Hunter Level 2", |
| 78 | Partner: "Partnered Server Owner", |
| 79 | Staff: "Discord Staff", |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 80 | VerifiedDeveloper: "Verified Bot Developer", |
| 81 | ActiveDeveloper: "Active Developer", |
PineaFan | 538d375 | 2023-01-12 21:48:23 +0000 | [diff] [blame] | 82 | Quarantined: "Quarantined [[What does this mean?]](https://support.discord.com/hc/en-us/articles/6461420677527)", |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 83 | Spammer: "Likely Spammer" |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 84 | // CertifiedModerator |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 85 | // VerifiedBot |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 86 | }; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 87 | const members = await guild.members.fetch(); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 88 | const membersArray = [...members.values()]; |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 89 | membersArray.sort((a, b) => { |
| 90 | if (a.joinedTimestamp === null) return 1; |
| 91 | if (b.joinedTimestamp === null) return -1; |
| 92 | return a.joinedTimestamp - b.joinedTimestamp; |
| 93 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 94 | const joinPos = membersArray.findIndex((m) => m.id === member.user.id); |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 95 | |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 96 | const roles = member.roles.cache.filter((r) => r.id !== guild.id).sort(); |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 97 | let s = ""; |
| 98 | let count = 0; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 99 | let ended = false; |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 100 | for (const roleId of roles) { |
| 101 | const string = `<@&${roleId[1].id}>, `; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 102 | if (s.length + string.length > 1000) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 103 | ended = true; |
| 104 | s += `and ${roles.size - count} more`; |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 105 | break; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 106 | } |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 107 | count++; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 108 | s += string; |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 109 | } |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 110 | if (s.length > 0 && !ended) s = s.slice(0, -2); |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 111 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 112 | let perms = ""; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 113 | const permsArray: Record<string, string> = { |
| 114 | Administrator: "Administrator", |
| 115 | ManageGuild: "Manage Server", |
| 116 | ManageRoles: "Manage Roles", |
| 117 | ManageChannels: "Manage Channels", |
| 118 | KickMembers: "Kick Members", |
| 119 | BanMembers: "Ban Members", |
| 120 | ModerateMembers: "Moderate Members", |
| 121 | ManageNicknames: "Manage Nicknames", |
| 122 | ManageWebhooks: "Manage Webhooks", |
| 123 | ManageMessages: "Manage Messages", |
| 124 | ViewAuditLog: "View Audit Log", |
| 125 | MentionEveryone: "Mention Everyone" |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 126 | }; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 127 | Object.keys(permsArray).map((perm) => { |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 128 | const hasPerm = member.permissions.has(perm as PermissionResolvable); |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 129 | perms += `${getEmojiByName("CONTROL." + (hasPerm ? "TICK" : "CROSS"))} ${permsArray[perm]}\n`; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 130 | }); |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 131 | |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 132 | let selectPaneOpen = false; |
| 133 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 134 | const embeds = [ |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 135 | new Embed() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 136 | .setEmbed( |
| 137 | new EmojiEmbed() |
| 138 | .setTitle("User Info: General") |
| 139 | .setStatus("Success") |
| 140 | .setEmoji("MEMBER.JOIN") |
| 141 | .setDescription( |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 142 | flags.map((flag) => { |
| 143 | if (nameReplacements[flag]) { |
| 144 | const emoji = getEmojiByName(`BADGES.${flag}`) |
| 145 | if (emoji) return (emoji + " " + nameReplacements[flag] + "\n"); |
| 146 | else return nameReplacements[flag] + "\n"; |
| 147 | } |
| 148 | }).join("") + "\n" + |
| 149 | generateKeyValueList({ |
| 150 | member: renderUser(member.user), |
| 151 | nickname: member.nickname ?? "*None set*", |
| 152 | id: `\`${member.id}\``, |
| 153 | "joined the server": renderDelta(member.joinedTimestamp!), |
| 154 | "joined discord": renderDelta(member.user.createdTimestamp), |
| 155 | "boost status": member.premiumSince |
| 156 | ? `Started boosting ${renderDelta(member.premiumSinceTimestamp!)}` |
| 157 | : "*Not boosting*", |
| 158 | "join position": `${joinPos + 1}` |
| 159 | }) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 160 | ) |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 161 | .setThumbnail(member.user.displayAvatarURL()) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 162 | ) |
| 163 | .setTitle("General") |
| 164 | .setDescription("General information about the user") |
| 165 | .setPageId(0), |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 166 | new Embed() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 167 | .setEmbed( |
| 168 | new EmojiEmbed() |
| 169 | .setTitle("User Info: Roles") |
| 170 | .setStatus("Success") |
| 171 | .setEmoji("GUILD.ROLES.CREATE") |
| 172 | .setDescription( |
| 173 | generateKeyValueList({ |
| 174 | member: renderUser(member.user), |
| 175 | id: `\`${member.id}\``, |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 176 | roles: `${member.roles.cache.size - 1}` // FIXME |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 177 | }) + |
| 178 | "\n" + |
| 179 | (s.length > 0 ? s : "*None*") + |
| 180 | "\n" |
| 181 | ) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 182 | ) |
| 183 | .setTitle("Roles") |
| 184 | .setDescription("Roles the user has") |
| 185 | .setPageId(1), |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 186 | new Embed() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 187 | .setEmbed( |
| 188 | new EmojiEmbed() |
| 189 | .setTitle("User Info: Key Permissions") |
| 190 | .setStatus("Success") |
| 191 | .setEmoji("GUILD.ROLES.CREATE") |
| 192 | .setDescription( |
| 193 | generateKeyValueList({ |
| 194 | member: renderUser(member.user), |
| 195 | id: `\`${member.id}\`` |
| 196 | }) + |
| 197 | "\n" + |
| 198 | perms |
| 199 | ) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 200 | ) |
| 201 | .setTitle("Key Permissions") |
| 202 | .setDescription("Key permissions the user has") |
| 203 | .setPageId(2) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 204 | ]; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 205 | if (member.user.bannerURL() ) { embeds[0]!.embed.setImage(member.user.bannerURL()!); } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 206 | let page = 0; |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 207 | let timedOut = false; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 208 | for (const embed of embeds) { |
| 209 | embed.embed.setDescription(embed.embed.description + "\n" + createPageIndicator(embeds.length, embed.pageId)); |
| 210 | } |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 211 | while (!timedOut) { |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 212 | const em = embeds[page]!.embed; |
| 213 | |
| 214 | let selectPane: ActionRowBuilder<ButtonBuilder | StringSelectMenuBuilder>[] = []; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 215 | |
| 216 | if (selectPaneOpen) { |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 217 | const options: APISelectMenuOption[] = []; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 218 | embeds.forEach((embed) => { |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 219 | options.push({ |
| 220 | label: embed.title, |
| 221 | value: embed.pageId.toString(), |
| 222 | description: embed.description || "" |
| 223 | }); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 224 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 225 | selectPane = [ |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 226 | new ActionRowBuilder<StringSelectMenuBuilder>().addComponents( |
| 227 | new Discord.StringSelectMenuBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 228 | .addOptions(options) |
| 229 | .setCustomId("page") |
| 230 | .setMaxValues(1) |
| 231 | .setPlaceholder("Choose a page...") |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 232 | ) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 233 | ]; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 234 | } |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 235 | const m = await interaction.editReply({ |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 236 | embeds: [em], |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 237 | components: selectPane.concat([ |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 238 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 239 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 240 | .setEmoji(getEmojiByName("CONTROL.LEFT", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 241 | .setStyle(ButtonStyle.Secondary) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 242 | .setCustomId("left") |
| 243 | .setDisabled(page === 0), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 244 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 245 | .setEmoji(getEmojiByName("CONTROL.MENU", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 246 | .setStyle(selectPaneOpen ? ButtonStyle.Primary : ButtonStyle.Secondary) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 247 | .setCustomId("select") |
| 248 | .setDisabled(false), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 249 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 250 | .setEmoji(getEmojiByName("CONTROL.RIGHT", "id")) |
| 251 | .setCustomId("right") |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 252 | .setStyle(ButtonStyle.Secondary) |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 253 | .setDisabled(page === embeds.length - 1) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 254 | ]) |
| 255 | ]) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 256 | }); |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 257 | let i: MessageComponentInteraction; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 258 | try { |
PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 259 | i = await m.awaitMessageComponent({ |
| 260 | time: 300000, |
TheCodedProf | 267563a | 2023-01-21 17:00:57 -0500 | [diff] [blame^] | 261 | filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id && i.message.id === m.id } |
PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 262 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 263 | } catch { |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 264 | timedOut = true; |
| 265 | continue; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 266 | } |
TheCodedProf | 267563a | 2023-01-21 17:00:57 -0500 | [diff] [blame^] | 267 | await i.deferUpdate(); |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 268 | if (i.customId === "left") { |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 269 | if (page > 0) page--; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 270 | selectPaneOpen = false; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 271 | } else if (i.customId === "right") { |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 272 | if (page < embeds.length - 1) page++; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 273 | selectPaneOpen = false; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 274 | } else if (i.customId === "select") { |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 275 | selectPaneOpen = !selectPaneOpen; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 276 | } else if (i.customId === "page" && i.isStringSelectMenu()) { |
| 277 | page = parseInt(i.values[0]!); |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 278 | selectPaneOpen = false; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 279 | } |
| 280 | } |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 281 | const em = embeds[page]!.embed; |
| 282 | em.setDescription(em.description + " | Message closed"); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 283 | await interaction.editReply({ |
| 284 | embeds: [em], |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 285 | components: [] |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 286 | }); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 287 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 288 | |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 289 | const check = () => { |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 290 | return true; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 291 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 292 | |
| 293 | export { command }; |
| 294 | export { callback }; |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 295 | export { check }; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 296 | export { userAbout }; |