How to use the matrix-bot-sdk.Permalinks.forRoom function in matrix-bot-sdk

To help you get started, we’ve selected a few matrix-bot-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matrix-org / mjolnir / src / commands / CreateBanListCommand.ts View on Github external
// populated in a moment
        },
        "users_default": 0,
    };
    powerLevels['users'][await mjolnir.client.getUserId()] = 100;
    powerLevels['users'][event['sender']] = 50;

    const listRoomId = await mjolnir.client.createRoom({
        preset: "public_chat",
        room_alias_name: aliasLocalpart,
        invite: [event['sender']],
        initial_state: [{type: SHORTCODE_EVENT_TYPE, state_key: "", content: {shortcode: shortcode}}],
        power_level_content_override: powerLevels,
    });

    const roomRef = Permalinks.forRoom(listRoomId);
    await mjolnir.watchList(roomRef);

    const html = `Created new list (<a href="${roomRef}">${listRoomId}</a>). This list is now being watched.`;
    const text = `Created new list (${roomRef}). This list is now being watched.`;
    const reply = RichReply.createFor(roomId, event, text, html);
    reply["msgtype"] = "m.notice";
    await mjolnir.client.sendMessage(roomId, reply);
}