import { Connection } from '../skychat/Connection.js'; import { Message } from '../skychat/Message.js'; import { Plugin } from './Plugin.js'; import { Room } from '../skychat/Room.js'; export declare abstract class RoomPlugin extends Plugin { /** * Some plugins (i.e. plugin to ban users) are globally available. * They have a single storage file, and they are instantiated only once at the root-level instead of once per room. * This static attribute need to be set */ static readonly isGlobal: boolean; /** * If the plugin is attached to a room, contain the reference to the room */ readonly room: Room; /** * A plugin is attached to a given room * @param room */ constructor(room: Room); /** * Get this plugin's storage path * @override */ getStoragePath(): string; /** * Get a summary of this plugin state to include in the room list */ getRoomSummary(): unknown; /** * Executed before broadcasting a message to the room * @abstract * @param message * @param _connection */ onBeforeMessageBroadcastHook(message: Message, _connection?: Connection): Promise; /** * Executed before a connection joins a room * @abstract * @param _connection * @param _room */ onBeforeConnectionJoinedRoom(_connection: Connection, _room: Room): Promise; /** * Executed when a connection joins a room * @abstract * @param _connection */ onConnectionJoinedRoom(_connection: Connection): Promise; /** * Executed when a connection is closed * @abstract * @param _connection */ onConnectionLeftRoom(_connection: Connection): Promise; } /** * Defines default constructor for a room plugin (required for TypeScript) */ export interface RoomPluginConstructor { new (_room: Room): RoomPlugin; commandName: string; commandAliases: string[]; defaultDataStorageValue?: any; }