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"; |
TheCodedProf | f86ba09 | 2023-01-27 17:10:07 -0500 | [diff] [blame] | 13 | import type { SlashCommandSubcommandBuilder } from "discord.js"; |
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}\``, |
TheCodedProf | 1f67504 | 2023-02-16 17:01:29 -0500 | [diff] [blame^] | 176 | roles: `${member.roles.cache.size - 1}` |
| 177 | }) + "\n" + (s.length > 0 ? s : "*None*") + "\n" |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 178 | ) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 179 | ) |
| 180 | .setTitle("Roles") |
| 181 | .setDescription("Roles the user has") |
| 182 | .setPageId(1), |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 183 | new Embed() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 184 | .setEmbed( |
| 185 | new EmojiEmbed() |
| 186 | .setTitle("User Info: Key Permissions") |
| 187 | .setStatus("Success") |
| 188 | .setEmoji("GUILD.ROLES.CREATE") |
| 189 | .setDescription( |
| 190 | generateKeyValueList({ |
| 191 | member: renderUser(member.user), |
| 192 | id: `\`${member.id}\`` |
| 193 | }) + |
| 194 | "\n" + |
| 195 | perms |
| 196 | ) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 197 | ) |
| 198 | .setTitle("Key Permissions") |
| 199 | .setDescription("Key permissions the user has") |
| 200 | .setPageId(2) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 201 | ]; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 202 | if (member.user.bannerURL() ) { embeds[0]!.embed.setImage(member.user.bannerURL()!); } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 203 | let page = 0; |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 204 | let timedOut = false; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 205 | for (const embed of embeds) { |
| 206 | embed.embed.setDescription(embed.embed.description + "\n" + createPageIndicator(embeds.length, embed.pageId)); |
| 207 | } |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 208 | while (!timedOut) { |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 209 | const em = embeds[page]!.embed; |
| 210 | |
| 211 | let selectPane: ActionRowBuilder<ButtonBuilder | StringSelectMenuBuilder>[] = []; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 212 | |
| 213 | if (selectPaneOpen) { |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 214 | const options: APISelectMenuOption[] = []; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 215 | embeds.forEach((embed) => { |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 216 | options.push({ |
| 217 | label: embed.title, |
| 218 | value: embed.pageId.toString(), |
| 219 | description: embed.description || "" |
| 220 | }); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 221 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 222 | selectPane = [ |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 223 | new ActionRowBuilder<StringSelectMenuBuilder>().addComponents( |
| 224 | new Discord.StringSelectMenuBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 225 | .addOptions(options) |
| 226 | .setCustomId("page") |
| 227 | .setMaxValues(1) |
| 228 | .setPlaceholder("Choose a page...") |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 229 | ) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 230 | ]; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 231 | } |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 232 | const m = await interaction.editReply({ |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 233 | embeds: [em], |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 234 | components: selectPane.concat([ |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 235 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 236 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 237 | .setEmoji(getEmojiByName("CONTROL.LEFT", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 238 | .setStyle(ButtonStyle.Secondary) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 239 | .setCustomId("left") |
| 240 | .setDisabled(page === 0), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 241 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 242 | .setEmoji(getEmojiByName("CONTROL.MENU", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 243 | .setStyle(selectPaneOpen ? ButtonStyle.Primary : ButtonStyle.Secondary) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 244 | .setCustomId("select") |
| 245 | .setDisabled(false), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 246 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 247 | .setEmoji(getEmojiByName("CONTROL.RIGHT", "id")) |
| 248 | .setCustomId("right") |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 249 | .setStyle(ButtonStyle.Secondary) |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 250 | .setDisabled(page === embeds.length - 1) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 251 | ]) |
| 252 | ]) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 253 | }); |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 254 | let i: MessageComponentInteraction; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 255 | try { |
PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 256 | i = await m.awaitMessageComponent({ |
| 257 | time: 300000, |
TheCodedProf | 267563a | 2023-01-21 17:00:57 -0500 | [diff] [blame] | 258 | 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] | 259 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 260 | } catch { |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 261 | timedOut = true; |
| 262 | continue; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 263 | } |
TheCodedProf | 267563a | 2023-01-21 17:00:57 -0500 | [diff] [blame] | 264 | await i.deferUpdate(); |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 265 | if (i.customId === "left") { |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 266 | if (page > 0) page--; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 267 | selectPaneOpen = false; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 268 | } else if (i.customId === "right") { |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 269 | if (page < embeds.length - 1) 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 === "select") { |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 272 | selectPaneOpen = !selectPaneOpen; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 273 | } else if (i.customId === "page" && i.isStringSelectMenu()) { |
| 274 | page = parseInt(i.values[0]!); |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 275 | selectPaneOpen = false; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 276 | } |
| 277 | } |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 278 | const em = embeds[page]!.embed; |
| 279 | em.setDescription(em.description + " | Message closed"); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 280 | await interaction.editReply({ |
| 281 | embeds: [em], |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 282 | components: [] |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 283 | }); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 284 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 285 | |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 286 | export { command }; |
| 287 | export { callback }; |
PineaFan | c729e76 | 2023-01-02 22:11:34 +0000 | [diff] [blame] | 288 | export { userAbout }; |