discord-mcbe
    Preparing search index...

    Class ScriptWorld<SESSION>

    Type Parameters

    Index
    connectedAt: number = ...
    logger: Logger
    players: Map<UniqueId, ScriptPlayer> = ...
    scoreboard: ScriptScoreboard
    session: SESSION
    • Sends a chat message relayed from Discord. An add-on in the world may display it in place of discord-mcbe, for example to honor its own mute settings.

      Parameters

      • chat: {
            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;
        }
        • Readonlymessage: {
              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;
          }

          The Discord message text was built from.

          • Readonlyattachments: { contentType: string | null; name: string }[]
          • Readonlyauthor: { bot: boolean; displayName: string; id: string; username: string }
            • Readonlybot: boolean

              Always false for the sender, since chat from bots is not relayed. Can be true in referencedMessage.

            • ReadonlydisplayName: string

              Name shown across Discord. Falls back to username.

            • Readonlyid: string

              Discord user ID.

            • Readonlyusername: string
          • ReadonlychannelId: string
          • Readonlycontent: string

            Text after the message filters, with mentions already resolved to names. Empty when only files were sent.

          • Readonlyid: string
          • Readonlymember: { displayName: string; roles: { id: string; name: string }[] } | null

            null only when Discord did not send the member with the message, which is rare.

          • Readonlymentions: {
                everyone: boolean;
                roles: { id: string; name: string }[];
                users: { bot: boolean; displayName: string; id: string; username: string }[];
            }
            • Readonlyeveryone: boolean

              Whether @everyone or @here was used.

            • Readonlyroles: { id: string; name: string }[]
            • Readonlyusers: { bot: boolean; displayName: string; id: string; username: string }[]

              Mentioned users. Includes the author of the replied-to message when the reply pings them.

          • ReadonlyreferencedMessage:
                | {
                    author: {
                        bot: boolean;
                        displayName: string;
                        id: string;
                        username: string;
                    };
                    content: string;
                    id: string;
                    member: | { displayName: string; roles: { id: string; name: string }[] }
                    | null;
                }
                | null

            The message this one replies to, or null.

        • Readonlytext: string

          Ready-to-display text built from the translation templates.

      Returns Promise<void>

    • Parameters

      • message: string | RawMessage | (string | RawMessage)[]

      Returns Promise<void>