kbotify
Version:
kaiheila bot framework
38 lines • 1.42 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GuildChannel = void 0;
const bot_object_1 = require("../base/bot.object");
class GuildChannel extends bot_object_1.BaseObject {
constructor(rawChannelObject, client) {
super(client);
this.invite = undefined;
this.full = async () => {
const rawChannel = await this.client.API.channel.view(this.id);
return new GuildChannel(rawChannel, this.client);
};
this.sendMessage = async (type, content, quote, tempTargetId) => {
return this.client.API.message.create(type, this.id, content, quote, tempTargetId);
};
this.getInvite = async () => {
if (this.invite) {
return this.invite;
}
const result = await this.client.API.invite.create(undefined, this.id);
return result.url;
};
this.client = client;
this.id = rawChannelObject.id;
const raw = rawChannelObject;
for (const prop in rawChannelObject) {
this[prop] = raw[prop] !== undefined ? raw[prop] : this[prop];
}
}
get mention() {
return `(chn)${this.id}(chn)`;
}
}
exports.GuildChannel = GuildChannel;
GuildChannel.fromRaw = (rawChannelObject, client) => {
return new GuildChannel(rawChannelObject, client);
};
//# sourceMappingURL=guild.js.map