forked from cadence/out-of-your-element
Start work on pinned events
This commit is contained in:
parent
bf0691f9bb
commit
48d69c0539
9 changed files with 427 additions and 2 deletions
22
d2m/actions/update-pins.js
Normal file
22
d2m/actions/update-pins.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
// @ts-check
|
||||
|
||||
const passthrough = require("../../passthrough")
|
||||
const {discord, sync} = passthrough
|
||||
/** @type {import("../converters/pins-to-list")} */
|
||||
const pinsToList = sync.require("../converters/pins-to-list")
|
||||
/** @type {import("../../matrix/api")} */
|
||||
const api = sync.require("../../matrix/api")
|
||||
|
||||
/**
|
||||
* @param {string} channelID
|
||||
* @param {string} roomID
|
||||
*/
|
||||
async function updatePins(channelID, roomID) {
|
||||
const pins = await discord.snow.channel.getChannelPinnedMessages(channelID)
|
||||
const eventIDs = pinsToList.pinsToList(pins)
|
||||
await api.sendState(roomID, "m.room.pinned_events", "", {
|
||||
pinned: eventIDs
|
||||
})
|
||||
}
|
||||
|
||||
module.exports.updatePins = updatePins
|
Loading…
Add table
Add a link
Reference in a new issue