summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/structures/MentionableSelectMenuInteraction.js
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
commite4450c8417624b71d779cb4f41692538f9165e10 (patch)
treeb70826542223ecdf8a7a259f61b0a1abb8a217d8 /node_modules/discord.js/src/structures/MentionableSelectMenuInteraction.js
downloadsowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.gz
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.bz2
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.zip
first commit
Diffstat (limited to 'node_modules/discord.js/src/structures/MentionableSelectMenuInteraction.js')
-rw-r--r--node_modules/discord.js/src/structures/MentionableSelectMenuInteraction.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/structures/MentionableSelectMenuInteraction.js b/node_modules/discord.js/src/structures/MentionableSelectMenuInteraction.js
new file mode 100644
index 0000000..416d5ce
--- /dev/null
+++ b/node_modules/discord.js/src/structures/MentionableSelectMenuInteraction.js
@@ -0,0 +1,71 @@
+'use strict';
+
+const { Collection } = require('@discordjs/collection');
+const MessageComponentInteraction = require('./MessageComponentInteraction');
+const Events = require('../util/Events');
+
+/**
+ * Represents a {@link ComponentType.MentionableSelect} select menu interaction.
+ * @extends {MessageComponentInteraction}
+ */
+class MentionableSelectMenuInteraction extends MessageComponentInteraction {
+ constructor(client, data) {
+ super(client, data);
+ const { resolved, values } = data.data;
+ const { members, users, roles } = resolved ?? {};
+
+ /**
+ * An array of the selected user and role ids
+ * @type {Snowflake[]}
+ */
+ this.values = values ?? [];
+
+ /**
+ * Collection of the selected users
+ * @type {Collection<Snowflake, User>}
+ */
+ this.users = new Collection();
+
+ /**
+ * Collection of the selected users
+ * @type {Collection<Snowflake, GuildMember|APIGuildMember>}
+ */
+ this.members = new Collection();
+
+ /**
+ * Collection of the selected roles
+ * @type {Collection<Snowflake, Role|APIRole>}
+ */
+ this.roles = new Collection();
+
+ if (members) {
+ for (const [id, member] of Object.entries(members)) {
+ const user = users[id];
+ if (!user) {
+ this.client.emit(
+ Events.Debug,
+ `[MentionableSelectMenuInteraction] Received a member without a user, skipping ${id}`,
+ );
+
+ continue;
+ }
+
+ this.members.set(id, this.guild?.members._add({ user, ...member }) ?? { user, ...member });
+ }
+ }
+
+ if (users) {
+ for (const user of Object.values(users)) {
+ this.users.set(user.id, this.client.users._add(user));
+ }
+ }
+
+ if (roles) {
+ for (const role of Object.values(roles)) {
+ this.roles.set(role.id, this.guild?.roles._add(role) ?? role);
+ }
+ }
+ }
+}
+
+module.exports = MentionableSelectMenuInteraction;