UNPKG

fnbr

Version:

A library to interact with Epic Games' Fortnite HTTP and XMPP services

101 lines (100 loc) 3.75 kB
import Base from '../Base'; import type { Stanzas, Constants } from 'stanza'; import type Client from '../Client'; /** * Represents the client's XMPP manager * @private */ declare class XMPP extends Base { /** * XMPP agent */ private connection?; /** * The amount of times the XMPP agent has tried to reconnect */ private connectionRetryCount; /** * The time the XMPP agent connected at */ private connectedAt?; /** * @param client The main client */ constructor(client: Client); /** * Whether the XMPP agent is connected */ get isConnected(): boolean; /** * Returns the xmpp JID */ get JID(): string | undefined; /** * Returns the xmpp resource */ get resource(): string | undefined; /** * Connects the XMPP agent to Epicgames' XMPP servers * @param sendStatusWhenConnected Whether to send an empty status status when connected */ connect(sendStatusWhenConnected?: boolean): Promise<void>; /** * Disconnects the XMPP client. * Also performs a cleanup */ disconnect(): void; /** * Registers all events */ private setupEvents; /** * Waits for a friend to be added to the clients cache */ private waitForFriend; /** * Sends a presence to all or a specific friend * @param status The status message. Can be undefined if you want to reset it * @param show The show type of the presence (eg "away") * @param to The JID of a specific friend */ sendStatus(status?: object | string, show?: Constants.PresenceShow, to?: string): void; /** * Sends an XMPP message * @param to The message receiver's JID * @param content The message that will be sent * @param type The message type (eg "chat" or "groupchat") * @deprecated this doesn't work anymore, since chat messages are handled via an rest api now see {@link Client#chat}. This function will be removed in a future version */ sendMessage(to: string, content: string, type?: Constants.MessageType): Promise<Stanzas.Message | undefined>; /** * Wait until a message is sent * @param id The message id * @param timeout How long to wait for the message * @deprecated this doesn't work anymore, since chat messages are handled via an rest api now see {@link Client#chat}. This function will be removed in a future version */ waitForSentMessage(id: string, timeout?: number): Promise<Stanzas.Message | undefined>; /** * Joins a multi user chat room (MUC) * @param jid The room's JID * @param nick The client's nickname * @deprecated this doesn't work anymore, since chat messages are handled via an rest api now see {@link Client#chat}. This function will be removed in a future version */ joinMUC(jid: string, nick: string): Promise<Stanzas.ReceivedMUCPresence>; /** * Leaves a multi user chat room (MUC) * @param jid The room's JID * @param nick The client's nickname * @deprecated this doesn't work anymore, since chat messages are handled via an rest api now see {@link Client#chat}. This function will be removed in a future version */ leaveMUC(jid: string, nick: string): Promise<Stanzas.ReceivedPresence>; /** * Bans a member from a multi user chat room * @param member The member that should be banned * @deprecated this doesn't work anymore, since chat messages are handled via an rest api now see {@link Client#chat}. This function will be removed in a future version */ ban(jid: string, member: string): Promise<Stanzas.IQ & { muc: Stanzas.MUCUserList; }>; } export default XMPP;