synchronise channel updates

This commit is contained in:
Cadence Ember
2023-08-19 23:12:36 +12:00
parent 3436759504
commit 08d3f3d804
3 changed files with 29 additions and 3 deletions

View File

@@ -10,6 +10,8 @@ const editMessage = sync.require("./actions/edit-message")
const deleteMessage = sync.require("./actions/delete-message")
/** @type {import("./actions/add-reaction")}) */
const addReaction = sync.require("./actions/add-reaction")
/** @type {import("./actions/create-room")}) */
const createRoom = sync.require("./actions/create-room")
/** @type {import("../matrix/api")}) */
const api = sync.require("../matrix/api")
@@ -99,6 +101,17 @@ module.exports = {
}
},
/**
* @param {import("./discord-client")} client
* @param {import("discord-api-types/v10").GatewayChannelUpdateDispatchData} channelOrThread
* @param {boolean} isThread
*/
async onChannelOrThreadUpdate(client, channelOrThread, isThread) {
const roomID = db.prepare("SELECT room_id FROM channel_room WHERE channel_id = ?").get(channelOrThread.id)
if (!roomID) return // No target room to update the data on
await createRoom.syncRoom(channelOrThread.id)
},
/**
* @param {import("./discord-client")} client
* @param {import("discord-api-types/v10").GatewayMessageCreateDispatchData} message