UNPKG

hennus-api

Version:

Esta es una libreria para el bot Hennus

50 lines (49 loc) 1.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InteractionSelectAny = void 0; const v10_1 = require("discord-api-types/v10"); const base_1 = require("./base"); class InteractionSelectAny extends base_1.ComponentsInteractionBased { constructor(data, client) { super(data, client); if (data.data.component_type != v10_1.ComponentType.Button) this.selectData = data.data; } ; get values() { return this.selectData.values; } ; get resolved() { return { user: (id) => this.resolve("user").users[id], member: (id) => (this.resolve("user").members ?? {})[id], channel: (id) => this.resolve("channel").channels[id], role: (id) => this.resolve("role").roles[id], mentionable: this.mentionable, }; } ; get mentionable() { const data = this.resolve("mentionable"); return { user: (id) => (data.users ?? {})[id], member: (id) => (data.members ?? {})[id], role: (id) => (data.roles ?? {})[id], }; } ; resolve(type) { if (type == "user" && this.selectData.component_type == v10_1.ComponentType.UserSelect) return this.selectData.resolved; else if (type == "role" && this.selectData.component_type == v10_1.ComponentType.RoleSelect) return this.selectData.resolved; else if (type == "channel" && this.selectData.component_type == v10_1.ComponentType.ChannelSelect) return this.selectData.resolved; else if (type == "mentionable" && this.selectData.component_type == v10_1.ComponentType.MentionableSelect) return this.selectData.resolved; else return { users: {}, roles: {}, members: {}, channels: {} }; } ; } exports.InteractionSelectAny = InteractionSelectAny; ;