discord-mcbe
    Preparing search index...

    Class ServerNetSession

    Implements

    Index
    disconnectReason: DisconnectReason | null = null
    id: `${string}-${string}-${string}-${string}-${string}` = ...
    isConnected: boolean = false
    isDestroyed: boolean = false
    requestInfo: ConnectionInfo
    worldName: string = ''
    • Parameters

      • response:
            | {
                data: unknown;
                ok: true;
                requestId: string;
                type: "__internal__:response";
            }
            | {
                error: | {
                    code: Abort
                    | Timeout
                    | InvalidSession
                    | InternalError;
                    message: string;
                }
                | { code: InvalidPayload; issues: unknown[]; message: string };
                ok: false;
                requestId: string;
                type: "__internal__:response";
            }

      Returns void

    • Type Parameters

      • T extends
            | Disconnect
            | Ping
            | SendMessage
            | RunCommand
            | SendScriptEvent
            | GetTPS
            | GetEntityLocation
            | GetEntityDimension
            | GetGameMode
            | SetGameMode
            | SetTitle
            | UpdateSubtitle
            | SetActionBar
            | KickPlayer
            | DiscordChat
            | GetScore
            | UpdateScore
            | GetAllScores
            | RemoveParticipant
            | GetObjective
            | GetAllObjectives
            | UpdateObjective
            | SetObjectiveDisplay

      Parameters

      • type: T
      • data: ClientBoundRequestData<T>
      • timeout: number = 10_000

      Returns Promise<RequestResult<ClientBoundResponseData<T>>>

    • Parameters

      • payload:
            | {
                data: { reason: DisconnectReason };
                requestId: string;
                type: Disconnect;
            }
            | { data: { sentAt: number }; requestId: string; type: Ping }
            | {
                data: {
                    message: string | RawMessage | (string | RawMessage)[];
                    playerUniqueId?: UniqueId;
                };
                requestId: string;
                type: SendMessage;
            }
            | {
                data: {
                    message: {
                        attachments: { contentType: string
                        | null; name: string }[];
                        author: {
                            bot: boolean;
                            displayName: string;
                            id: string;
                            username: string;
                        };
                        channelId: string;
                        content: string;
                        id: string;
                        member: | { displayName: string; roles: { id: string; name: string }[] }
                        | null;
                        mentions: {
                            everyone: boolean;
                            roles: { id: string; name: string }[];
                            users: {
                                bot: boolean;
                                displayName: string;
                                id: string;
                                username: string;
                            }[];
                        };
                        referencedMessage: | {
                            author: {
                                bot: boolean;
                                displayName: string;
                                id: string;
                                username: string;
                            };
                            content: string;
                            id: string;
                            member: | {
                                displayName: string;
                                roles: { id: string; name: string }[];
                            }
                            | null;
                        }
                        | null;
                    };
                    text: string;
                };
                requestId: string;
                type: DiscordChat;
            }
            | { data: { command: string }; requestId: string; type: RunCommand }
            | {
                data: { id: string; message: string };
                requestId: string;
                type: SendScriptEvent;
            }
            | { data: null; requestId: string; type: GetTPS }
            | {
                data: { entityUniqueId: string & { __brand: "UniqueId" } };
                requestId: string;
                type: GetEntityLocation;
            }
            | {
                data: { entityUniqueId: string & { __brand: "UniqueId" } };
                requestId: string;
                type: GetEntityDimension;
            }
            | {
                data: { playerUniqueId: string & { __brand: "UniqueId" } };
                requestId: string;
                type: GetGameMode;
            }
            | {
                data: {
                    gameMode: GameMode;
                    playerUniqueId: string & { __brand: "UniqueId" };
                };
                requestId: string;
                type: SetGameMode;
            }
            | {
                data: {
                    options?: {
                        fadeInDuration: number;
                        fadeOutDuration: number;
                        stayDuration: number;
                        subtitle?: string
                        | RawMessage
                        | (string | RawMessage)[];
                    };
                    playerUniqueId: string & { __brand: "UniqueId" };
                    title: string | RawMessage | (string | RawMessage)[];
                };
                requestId: string;
                type: SetTitle;
            }
            | {
                data: {
                    playerUniqueId: string & { __brand: "UniqueId" };
                    subtitle: string | RawMessage | (string | RawMessage)[];
                };
                requestId: string;
                type: UpdateSubtitle;
            }
            | {
                data: {
                    playerUniqueId: string & { __brand: "UniqueId" };
                    text: string | RawMessage | (string | RawMessage)[];
                };
                requestId: string;
                type: SetActionBar;
            }
            | {
                data: {
                    playerUniqueId: string & { __brand: "UniqueId" };
                    reason?: string;
                };
                requestId: string;
                type: KickPlayer;
            }
            | {
                data: {
                    objectiveId: string;
                    participant: | { uniqueId: string & { __brand: "UniqueId" } }
                    | { fakePlayer: string };
                };
                requestId: string;
                type: GetScore;
            }
            | {
                data: {
                    objectiveId: string;
                    participant: | { uniqueId: string & { __brand: "UniqueId" } }
                    | { fakePlayer: string };
                    score: number;
                    type: "set" | "add";
                };
                requestId: string;
                type: UpdateScore;
            }
            | { data: { objectiveId: string }; requestId: string; type: GetAllScores }
            | {
                data: {
                    objectiveId: string;
                    participant:
                        | { uniqueId: string & { __brand: "UniqueId" } }
                        | { fakePlayer: string };
                };
                requestId: string;
                type: RemoveParticipant;
            }
            | { data: { objectiveId: string }; requestId: string; type: GetObjective }
            | { data: null; requestId: string; type: GetAllObjectives }
            | {
                data: {
                    displayName?: string;
                    objectiveId: string;
                    type: "add" | "remove";
                };
                requestId: string;
                type: UpdateObjective;
            }
            | {
                data: {
                    displaySlotId: DisplaySlotId;
                    objectiveId?: string;
                    sortOrder?: Ascending
                    | Descending;
                };
                requestId: string;
                type: SetObjectiveDisplay;
            }
            | {
                data: unknown;
                ok: true;
                requestId: string;
                type: "__internal__:response";
            }
            | {
                error: | {
                    code: Abort
                    | Timeout
                    | InvalidSession
                    | InternalError;
                    message: string;
                }
                | { code: InvalidPayload; issues: unknown[]; message: string };
                ok: false;
                requestId: string;
                type: "__internal__:response";
            }

      Returns void