UNPKG

@wilcosp/rex

Version:

Rex is an automated command manager for discord js

93 lines (92 loc) 3.19 kB
"use strict"; /*! * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.RexSlashInteractionOptionsResolver = void 0; const v10_1 = require("discord-api-types/v10"); class RexSlashInteractionOptionsResolver { constructor(resolver) { this.resolver = resolver; } get resolved() { return this.resolver.resolved; } get client() { return this.resolver.client; } get data() { if (!this._data) { this._data = new Map(); switch (this.resolver.data[0]?.type) { case v10_1.ApplicationCommandOptionType.SubcommandGroup: { if (this.resolver.data[0]?.options?.[0]?.type == v10_1.ApplicationCommandOptionType.Subcommand) { for (const opt of this.resolver.data[0].options[0].options ?? []) { this._data.set(opt.name, opt); } break; } for (const opt of this.resolver.data[0].options ?? []) { this._data.set(opt.name, opt); } break; } case v10_1.ApplicationCommandOptionType.Subcommand: { for (const opt of this.resolver.data[0].options ?? []) { this._data.set(opt.name, opt); } break; } default: { for (const opt of this.resolver.data) { this._data.set(opt.name, opt); } break; } } } return this._data; } get(name, required) { return this.resolver.get(name, required); } getBoolean(name, required) { return this.resolver.getBoolean(name, required); } getChannel(name, required) { return this.resolver.getChannel(name, required); } getInteger(name, required) { return this.resolver.getInteger(name, required); } getNumber(name, required) { return this.resolver.getNumber(name, required); } getUser(name, required) { return this.resolver.getUser(name, required); } getMember(name) { return this.resolver.getMember(name); } getMentionable(name, required) { return this.resolver.getMentionable(name, required); } getRole(name, required) { return this.resolver.getRole(name, required); } getString(name, required) { return this.resolver.getString(name, required); } getMessage(name, required) { return this.resolver.getMessage(name, required); } getAttachment(name, required) { return this.resolver.getAttachment(name, required); } getFocused(getFull) { return this.resolver.getFocused(getFull); } } exports.RexSlashInteractionOptionsResolver = RexSlashInteractionOptionsResolver;