import type { Subscription } from "rxjs"; import type { SendChatMessageOptions } from "@workadventure/shared-utils"; import { IframeApiContribution } from "./IframeApiContribution"; import type { RemotePlayerInterface } from "./Players/RemotePlayer"; import type { PublicPlayerState } from "./PublicPlayerState"; export interface OnChatMessageOptions { scope: "local" | "bubble"; } export declare class WorkadventureChatCommands extends IframeApiContribution> { callbacks: { type: "userInputChat"; callback: (event: { message: string; senderId?: string | undefined; }) => void; }[]; /** * Open instantly the chat window. * {@link https://docs.workadventu.re/map-building/api-chat.md#open-the-chat-window | Website documentation} */ open(): void; /** * Close instantly the chat window. * {@link https://docs.workadventu.re/map-building/api-chat.md#close-the-chat-window | Website documentation} */ close(): void; /** * Sends a message in the chat. * {@link https://docs.workadventu.re/developer/map-scripting/references/api-chat#sending-a-message-in-the-chat | Website documentation} * * @param {string} message Message to be displayed in the chat * @param {SendChatMessageOptions|string|undefined} options Decides if the message is sent only to the local users or to all users in the bubble. In undefined, the message is sent to the local user only. If the message is sent locally, you can decide an "author" name to be displayed in the chat. It does not have to be a real user. If a string is passed instead of an object, it will be used as the Name displayed for the author of the message (and the message type will automatically by "local"). Using a string instead of an object is deprecated. */ sendChatMessage(message: string, options?: string | SendChatMessageOptions): void; /** * Simulates a user is currently typing a message in the chat. * * If the scope is "bubble", the typing indicator will be displayed in the chat of all users in the bubble (except the current user) * If the scope is "local", the typing indicator will be displayed in the chat of the current user only (and will appear to come from the user whose name is "author") * * @param options */ startTyping(options: SendChatMessageOptions): void; /** * Simulates a user has stopped typing a message in the chat. * * If the scope is "bubble", the typing indicator will be removed in the chat of all users in the bubble (except the current user) * If the scope is "local", the typing indicator will be removed in the chat of the current user only (and will appear to come from the user whose name is "author") * * @param options */ stopTyping(options: SendChatMessageOptions): void; /** * Listens to messages typed in the chat history. * {@link https://docs.workadventu.re/map-building/api-chat.md#listening-to-messages-from-the-chat | Website documentation} * * @param {function(message: string, event: { authorId: number|undefined, author: RemotePlayerInterface|undefined }): void} callback Function that will be called when a message is received. It contains the message typed by the user * @param {OnChatMessageOptions} options Options to decide if we listen only to messages from the local user (default) or from all users in the bubble. * @return {Subscription} Subscription to the chat message. Call ".unsubscribe()" to stop listening to the chat. */ onChatMessage(callback: (message: string, event: { authorId: number | undefined; author: RemotePlayerInterface | undefined; }) => void, options?: OnChatMessageOptions): Subscription; } declare const _default: WorkadventureChatCommands; export default _default;