pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 1 | import { LoadingEmbed } from "./../../utils/defaultEmbeds.js"; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 2 | import Discord, { |
| 3 | CommandInteraction, |
| 4 | GuildMember, |
| 5 | Message, |
| 6 | MessageActionRow, |
| 7 | MessageActionRowComponent, |
| 8 | MessageButton, |
| 9 | MessageComponentInteraction, |
| 10 | SelectMenuInteraction |
| 11 | } from "discord.js"; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 12 | import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders"; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 13 | import EmojiEmbed from "../../utils/generateEmojiEmbed.js"; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 14 | import getEmojiByName from "../../utils/getEmojiByName.js"; |
| 15 | import generateKeyValueList from "../../utils/generateKeyValueList.js"; |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 16 | import createPageIndicator from "../../utils/createPageIndicator.js"; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 17 | import client from "../../utils/client.js"; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 18 | |
| 19 | const command = (builder: SlashCommandSubcommandBuilder) => |
| 20 | builder |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 21 | .setName("about") |
| 22 | .setDescription("Shows info about a user") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 23 | .addUserOption((option) => |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 24 | option.setName("user").setDescription("The user to get info about | Default: Yourself") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 25 | ); |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 26 | |
| 27 | class Embed { |
| 28 | embed: Discord.MessageEmbed; |
| 29 | title: string; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 30 | description = ""; |
| 31 | pageId = 0; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 32 | setEmbed(embed: Discord.MessageEmbed) { |
| 33 | this.embed = embed; |
| 34 | return this; |
| 35 | } |
| 36 | setTitle(title: string) { |
| 37 | this.title = title; |
| 38 | return this; |
| 39 | } |
| 40 | setDescription(description: string) { |
| 41 | this.description = description; |
| 42 | return this; |
| 43 | } |
| 44 | setPageId(pageId: number) { |
| 45 | this.pageId = pageId; |
| 46 | return this; |
| 47 | } |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 48 | } |
| 49 | |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 50 | const callback = async (interaction: CommandInteraction): Promise<void> => { |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 51 | if (!interaction.guild) return; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 52 | const { renderUser, renderDelta } = client.logger; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 53 | const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 54 | const flags: string[] = []; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 55 | if ( |
| 56 | [ |
| 57 | "438733159748599813", // Pinea |
| 58 | "317731855317336067", // Mini |
| 59 | "261900651230003201", // Coded |
| 60 | "511655498676699136" // Zan |
| 61 | ].includes(member.user.id) |
| 62 | ) { |
| 63 | flags.push("NUCLEUSDEVELOPER"); |
| 64 | } |
| 65 | if ( |
| 66 | (await client.guilds.cache.get("684492926528651336")?.members.fetch()) |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 67 | ?.filter((m: GuildMember) => m.roles.cache.has("760896837866749972")) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 68 | ?.map((m: GuildMember) => m.id) |
| 69 | .includes(member.user.id) |
| 70 | ) { |
| 71 | flags.push("CLICKSDEVELOPER"); |
| 72 | } |
| 73 | member.user.flags.toArray().map((flag) => { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 74 | flags.push(flag.toString()); |
| 75 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 76 | if (member.user.bot) { |
| 77 | flags.push("BOT"); |
| 78 | } |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 79 | // Check if they are boosting the server |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 80 | if (member.premiumSince) { |
| 81 | flags.push("BOOSTER"); |
| 82 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 83 | const nameReplacements = { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 84 | NUCLEUSDEVELOPER: "**Nucleus Developer**", |
| 85 | CLICKSDEVELOPER: "Clicks Developer", |
| 86 | HOUSE_BRAVERY: "Hypesquad Bravery", |
| 87 | HOUSE_BRILLIANCE: "Hypesquad Brilliance", |
| 88 | HOUSE_BALANCE: "Hypesquad Balance", |
| 89 | HYPESQUAD_EVENTS: "Hypesquad Events", |
| 90 | EARLY_SUPPORTER: "Early Supporter", |
| 91 | BUGHUNTER_LEVEL_1: "Bug Hunter Level 1", |
| 92 | BUGHUNTER_LEVEL_2: "Bug Hunter Level 2", |
| 93 | PARTNERED_SERVER_OWNER: "Partnered Server Owner", |
| 94 | DISCORD_EMPLOYEE: "Discord Staff", |
| 95 | EARLY_VERIFIED_BOT_DEVELOPER: "Verified Bot Developer", |
| 96 | BOT: "Bot", |
| 97 | BOOSTER: "Server Booster" |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 98 | }; |
| 99 | const members = await interaction.guild.members.fetch(); |
| 100 | const membersArray = [...members.values()]; |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 101 | membersArray.sort((a, b) => { |
| 102 | if (a.joinedTimestamp === null) return 1; |
| 103 | if (b.joinedTimestamp === null) return -1; |
| 104 | return a.joinedTimestamp - b.joinedTimestamp; |
| 105 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 106 | const joinPos = membersArray.findIndex((m) => m.id === member.user.id); |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 107 | |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 108 | const roles = member.roles.cache.filter((r) => r.id !== interaction.guild!.id).sort(); |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 109 | let s = ""; |
| 110 | let count = 0; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 111 | let ended = false; |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 112 | for (const roleId in roles) { |
| 113 | const string = `<@&${roleId}>, `; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 114 | if (s.length + string.length > 1000) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 115 | ended = true; |
| 116 | s += `and ${roles.size - count} more`; |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 117 | break; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 118 | } |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 119 | count++; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 120 | s += string; |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 121 | } |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 122 | if (s.length > 0 && !ended) s = s.slice(0, -2); |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 123 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 124 | let perms = ""; |
| 125 | const permsArray = { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 126 | ADMINISTRATOR: "Administrator", |
| 127 | MANAGE_GUILD: "Manage Server", |
| 128 | MANAGE_ROLES: "Manage Roles", |
| 129 | MANAGE_CHANNELS: "Manage Channels", |
| 130 | KICK_MEMBERS: "Kick Members", |
| 131 | BAN_MEMBERS: "Ban Members", |
| 132 | MODERATE_MEMBERS: "Moderate Members", |
| 133 | MANAGE_NICKNAMES: "Manage Nicknames", |
| 134 | MANAGE_WEBHOOKS: "Manage Webhooks", |
| 135 | MANAGE_MESSAGES: "Manage Messages", |
| 136 | VIEW_AUDIT_LOG: "View Audit Log", |
| 137 | MENTION_EVERYONE: "Mention Everyone" |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 138 | }; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 139 | Object.keys(permsArray).map((perm) => { |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 140 | const hasPerm = member.permissions.has(perm as Discord.PermissionString); |
| 141 | perms += `${getEmojiByName("CONTROL." + (hasPerm ? "TICK" : "CROSS"))} ${permsArray[perm]}\n`; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 142 | }); |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 143 | |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 144 | let selectPaneOpen = false; |
| 145 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 146 | const embeds = [ |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 147 | new Embed() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 148 | .setEmbed( |
| 149 | new EmojiEmbed() |
| 150 | .setTitle("User Info: General") |
| 151 | .setStatus("Success") |
| 152 | .setEmoji("MEMBER.JOIN") |
| 153 | .setDescription( |
| 154 | flags |
| 155 | .map((flag) => { |
| 156 | if (nameReplacements[flag]) { |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 157 | return getEmojiByName(`BADGES.${flag}`) + " " + nameReplacements[flag]; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 158 | } |
| 159 | }) |
| 160 | .join("\n") + |
| 161 | "\n\n" + |
| 162 | generateKeyValueList({ |
| 163 | member: renderUser(member.user), |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 164 | nickname: member.nickname ?? "*None set*", |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 165 | id: `\`${member.id}\``, |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 166 | "joined the server": renderDelta(member.joinedTimestamp), |
| 167 | "joined discord": renderDelta(member.user.createdTimestamp), |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 168 | "boost status": member.premiumSince |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 169 | ? `Started boosting ${renderDelta(member.premiumSinceTimestamp)}` |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 170 | : "*Not boosting*", |
| 171 | "join position": `${joinPos + 1}` |
| 172 | }) |
| 173 | ) |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 174 | .setThumbnail(member.user.displayAvatarURL({ dynamic: true })) |
| 175 | .setImage((await member.user.fetch()).bannerURL({ format: "gif" })) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 176 | ) |
| 177 | .setTitle("General") |
| 178 | .setDescription("General information about the user") |
| 179 | .setPageId(0), |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 180 | new Embed() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 181 | .setEmbed( |
| 182 | new EmojiEmbed() |
| 183 | .setTitle("User Info: Roles") |
| 184 | .setStatus("Success") |
| 185 | .setEmoji("GUILD.ROLES.CREATE") |
| 186 | .setDescription( |
| 187 | generateKeyValueList({ |
| 188 | member: renderUser(member.user), |
| 189 | id: `\`${member.id}\``, |
| 190 | roles: `${member.roles.cache.size - 1}` |
| 191 | }) + |
| 192 | "\n" + |
| 193 | (s.length > 0 ? s : "*None*") + |
| 194 | "\n" |
| 195 | ) |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 196 | .setThumbnail(member.user.displayAvatarURL({ dynamic: true })) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 197 | ) |
| 198 | .setTitle("Roles") |
| 199 | .setDescription("Roles the user has") |
| 200 | .setPageId(1), |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 201 | new Embed() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 202 | .setEmbed( |
| 203 | new EmojiEmbed() |
| 204 | .setTitle("User Info: Key Permissions") |
| 205 | .setStatus("Success") |
| 206 | .setEmoji("GUILD.ROLES.CREATE") |
| 207 | .setDescription( |
| 208 | generateKeyValueList({ |
| 209 | member: renderUser(member.user), |
| 210 | id: `\`${member.id}\`` |
| 211 | }) + |
| 212 | "\n" + |
| 213 | perms |
| 214 | ) |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 215 | .setThumbnail(member.user.displayAvatarURL({ dynamic: true })) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 216 | ) |
| 217 | .setTitle("Key Permissions") |
| 218 | .setDescription("Key permissions the user has") |
| 219 | .setPageId(2) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 220 | ]; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 221 | const m = (await interaction.reply({ |
| 222 | embeds: LoadingEmbed, |
| 223 | fetchReply: true, |
| 224 | ephemeral: true |
| 225 | })) as Message; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 226 | let page = 0; |
| 227 | let breakReason = ""; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 228 | while (true) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 229 | const em = new Discord.MessageEmbed(embeds[page].embed); |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 230 | em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page)); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 231 | let selectPane = []; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 232 | |
| 233 | if (selectPaneOpen) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 234 | const options = []; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 235 | embeds.forEach((embed) => { |
| 236 | options.push( |
| 237 | new SelectMenuOption({ |
| 238 | label: embed.title, |
| 239 | value: embed.pageId.toString(), |
| 240 | description: embed.description || "" |
| 241 | }) |
| 242 | ); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 243 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 244 | selectPane = [ |
| 245 | new MessageActionRow().addComponents([ |
| 246 | new Discord.MessageSelectMenu() |
| 247 | .addOptions(options) |
| 248 | .setCustomId("page") |
| 249 | .setMaxValues(1) |
| 250 | .setPlaceholder("Choose a page...") |
| 251 | ]) |
| 252 | ]; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 253 | } |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 254 | await interaction.editReply({ |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 255 | embeds: [em], |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 256 | components: selectPane.concat([ |
| 257 | new MessageActionRow().addComponents([ |
| 258 | new MessageButton() |
| 259 | .setEmoji(getEmojiByName("CONTROL.LEFT", "id")) |
| 260 | .setStyle("SECONDARY") |
| 261 | .setCustomId("left") |
| 262 | .setDisabled(page === 0), |
| 263 | new MessageButton() |
| 264 | .setEmoji(getEmojiByName("CONTROL.MENU", "id")) |
| 265 | .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY") |
| 266 | .setCustomId("select") |
| 267 | .setDisabled(false), |
| 268 | new MessageButton() |
| 269 | .setEmoji(getEmojiByName("CONTROL.RIGHT", "id")) |
| 270 | .setCustomId("right") |
| 271 | .setStyle("SECONDARY") |
| 272 | .setDisabled(page === embeds.length - 1), |
| 273 | new MessageButton() |
| 274 | .setEmoji(getEmojiByName("CONTROL.CROSS", "id")) |
| 275 | .setCustomId("close") |
| 276 | .setStyle("DANGER") |
| 277 | ]) |
| 278 | ]) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 279 | }); |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 280 | let i: MessageComponentInteraction; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 281 | try { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 282 | i = await m.awaitMessageComponent({ time: 300000 }); |
| 283 | } catch { |
| 284 | breakReason = "Message timed out"; |
| 285 | break; |
| 286 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 287 | i.deferUpdate(); |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 288 | if ((i.component as MessageActionRowComponent).customId === "left") { |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 289 | if (page > 0) page--; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 290 | selectPaneOpen = false; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 291 | } else if ((i.component as MessageActionRowComponent).customId === "right") { |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 292 | if (page < embeds.length - 1) page++; |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 293 | selectPaneOpen = false; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 294 | } else if ((i.component as MessageActionRowComponent).customId === "select") { |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 295 | selectPaneOpen = !selectPaneOpen; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 296 | } else if ((i.component as MessageActionRowComponent).customId === "close") { |
pineafan | 167bde3 | 2022-05-19 19:33:46 +0100 | [diff] [blame] | 297 | breakReason = "Message closed"; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 298 | break; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 299 | } else if ((i.component as MessageActionRowComponent).customId === "page") { |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 300 | page = parseInt((i as SelectMenuInteraction).values[0]); |
pineafan | ea06304 | 2022-05-19 19:08:44 +0100 | [diff] [blame] | 301 | selectPaneOpen = false; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 302 | } else { |
pineafan | 167bde3 | 2022-05-19 19:33:46 +0100 | [diff] [blame] | 303 | breakReason = "Message closed"; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 304 | break; |
| 305 | } |
| 306 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 307 | const em = new Discord.MessageEmbed(embeds[page].embed); |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 308 | em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page) + " | " + breakReason); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 309 | await interaction.editReply({ |
| 310 | embeds: [em], |
| 311 | components: [ |
| 312 | new MessageActionRow().addComponents([ |
| 313 | new MessageButton() |
| 314 | .setEmoji(getEmojiByName("CONTROL.LEFT", "id")) |
| 315 | .setStyle("SECONDARY") |
| 316 | .setCustomId("left") |
| 317 | .setDisabled(true), |
| 318 | new MessageButton() |
| 319 | .setEmoji(getEmojiByName("CONTROL.MENU", "id")) |
| 320 | .setStyle("SECONDARY") |
| 321 | .setCustomId("select") |
| 322 | .setDisabled(true), |
| 323 | new MessageButton() |
| 324 | .setEmoji(getEmojiByName("CONTROL.RIGHT", "id")) |
| 325 | .setCustomId("right") |
| 326 | .setStyle("SECONDARY") |
| 327 | .setDisabled(true), |
| 328 | new MessageButton() |
| 329 | .setEmoji(getEmojiByName("CONTROL.CROSS", "id")) |
| 330 | .setCustomId("close") |
| 331 | .setStyle("DANGER") |
| 332 | .setDisabled(true) |
| 333 | ]) |
| 334 | ] |
| 335 | }); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 336 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 337 | |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 338 | const check = () => { |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 339 | return true; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 340 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 341 | |
| 342 | export { command }; |
| 343 | export { callback }; |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 344 | export { check }; |