Sync pins back from Matrix to Discord

This commit is contained in:
Cadence Ember 2025-01-07 12:23:39 +13:00
commit 06b6a63ee3
6 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,17 @@
// @ts-check
/**
* @param {string[]} pins
* @param {string[]} prev
* @returns {[string, boolean][]}
*/
function diffPins(pins, prev) {
/** @type {[string, boolean][]} */
const result = []
return result.concat(
prev.filter(id => !pins.includes(id)).map(id => [id, false]), // removed
pins.filter(id => !prev.includes(id)).map(id => [id, true]) // added
)
}
module.exports.diffPins = diffPins