guilded.ts
Version:
A powerful NPM module that allows you to easily interact with the Guilded API.
33 lines • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createChannel = void 0;
const Channel_1 = require("./structures/channel/Channel");
const ChatChannel_1 = require("./structures/channel/ChatChannel");
const DocChannel_1 = require("./structures/channel/DocChannel");
const ForumChannel_1 = require("./structures/channel/ForumChannel");
const ListChannel_1 = require("./structures/channel/ListChannel");
const CalendarChannel_1 = require("./structures/channel/CalendarChannel");
/**
* Create a channel structure.
* @param client The client the channel belongs to.
* @param raw The raw data of the channel.
* @param cache Whether to cache the channel.
* @returns The created channel structure.
* @example createChannel(client, rawChannel);
*/
const createChannel = (client, raw, cache) => new ChannelTypeMap[raw.type](client, raw, cache);
exports.createChannel = createChannel;
/** A map of channel types to their respective classes. */
const ChannelTypeMap = {
announcements: Channel_1.Channel,
media: Channel_1.Channel,
scheduling: Channel_1.Channel,
chat: ChatChannel_1.ChatChannel,
voice: ChatChannel_1.ChatChannel,
stream: ChatChannel_1.ChatChannel,
docs: DocChannel_1.DocChannel,
forums: ForumChannel_1.ForumChannel,
list: ListChannel_1.ListChannel,
calendar: CalendarChannel_1.CalendarChannel,
};
//# sourceMappingURL=util.js.map