@amelix/phoenix.js
Version:
A feature-rich API wrapper for the critically acclaimed chatting app Phoenix.. or something.
45 lines (44 loc) • 1.62 kB
TypeScript
import { Client } from "./Client";
import Message from "./Message";
import ServerChannel from "./ServerChannel";
export default class TextChannel extends ServerChannel {
private messageQueries;
/** Whether or not every message in this channel has been fetched. */
fullyCached: boolean;
/** All the cached messages in this channel. Not in actual order. */
messages: Map<string, Message>;
/** An array of the IDs of the messages in this channel. In actual order of how messages appear in the channel. */
messageIDs: string[];
/** An array of the IDs of users currently typing in this channel. */
usersTyping: string[];
/** Whether or not the client is currently typing in this channel. */
clientTyping: boolean;
constructor(client: Client, data: any);
/** Send a message to the channel. */
send(content: string): Promise<Message>;
private addMessage;
/** Fetch a single message from this channel. */
fetchMessage(id: string): Promise<Message>;
/** Fetch messages from this channel. */
fetchMessages(options?: MessageFetchingOptions): Promise<Map<any, any>>;
/**
* Check if a user is typing in this channel.
* @param {string} id User ID
*/
isTyping(id: string): boolean;
/**
* Start a typing indicator in this channel.
*/
startTyping(): void;
/**
* Stop the typing indicator in this channel.
*/
stopTyping(): void;
}
interface MessageFetchingOptions {
limit?: number;
before?: string;
after?: string;
around?: string;
}
export {};