UNPKG

@evolvejs/core

Version:

An advanced Discord API wrapper with TS and JS support

46 lines (45 loc) 1.98 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GroupChannel = void 0; const __1 = require("../.."); const objex_1 = require("@evolvejs/objex"); const Channel_1 = require("./Channel"); const Endpoints_1 = require("../../Utils/Endpoints"); class GroupChannel extends Channel_1.Channel { constructor(data, client, owner) { super(data.id, __1.CHANNELTYPES.Group, client); this.owner = owner; this.recipients = new objex_1.Objex(); Object.defineProperty(this, "data", { value: data, enumerable: false, writable: false, }); this._handle(); } _handle() { if (!this.data) return; this.name = this.data.name; this.lastMessage = this.data.last_message_id || undefined; this.icon = this.data.icon || undefined; this.applicationID = this.data.application_id; this.lastPin = this.data.last_pin_timestamp; return this; } static new(data, client) { return __awaiter(this, void 0, void 0, function* () { return new GroupChannel(data, client, new __1.User(yield client.rest.endpoint(Endpoints_1.Endpoints.USER).get(data.owner_id))); }); } } exports.GroupChannel = GroupChannel;