Update Discord libraries

This commit is contained in:
Cadence Ember
2026-01-21 14:33:24 +13:00
parent 345b7d6135
commit 90fcbd0ddc
7 changed files with 59 additions and 56 deletions

View File

@@ -140,10 +140,20 @@ function diffKState(actual, target) {
/**
* Async because it gets all room state from the homeserver.
* @param {string} roomID
* @param {[type: string, key: string][]} [limitToEvents]
*/
async function roomToKState(roomID) {
const root = await api.getAllState(roomID)
return stateToKState(root)
async function roomToKState(roomID, limitToEvents) {
if (!limitToEvents) {
const root = await api.getAllState(roomID)
return stateToKState(root)
} else {
const root = []
await Promise.all(limitToEvents.map(async ([type, key]) => {
const outer = await api.getStateEventOuter(roomID, type, key)
root.push(outer)
}))
return stateToKState(root)
}
}
/**