UNPKG

hackmud-chat

Version:
29 lines 797 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Represents a account user. */ class User { constructor(api, name, channels) { this.name = name; this.channels = channels; this.api = api; } /** * Returns the user channel from the given name. * @param name The channel name. */ getChannelByName(name) { return this.channels.filter((x) => x.name === name)[0]; } /** * Send a message to another user. * @param user The user to send the message to. * @param msg The content of the message. */ async send(user, msg) { return await this.api.sendMessage(this.name, user, msg); } } exports.User = User; //# sourceMappingURL=user.js.map