//native
type Matrix = {
baseUrl: string;
token: string;
};
export async function main(matrix_res: Matrix, room_id: string) {
const url = `${
matrix_res.baseUrl
}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state`;
const resp = await fetch(url, {
headers: {
Authorization: `Bearer ${matrix_res.token}`,
},
});
if (!resp.ok) {
throw Error(`Failed to read room state: Error HTTP${resp.status}`);
}
return {
events: await resp.json(),
};
}
Submitted by hugo989 4 days ago