2023-07-02 13:06:05 +00:00
|
|
|
// @ts-check
|
|
|
|
|
2023-07-03 05:20:24 +00:00
|
|
|
/**
|
|
|
|
* Grab Matrix events we care about, check them, and bridge them.
|
|
|
|
*/
|
|
|
|
|
2023-06-28 20:08:17 +00:00
|
|
|
const {sync, as} = require("../passthrough")
|
2023-07-03 12:39:42 +00:00
|
|
|
|
2023-07-03 05:20:24 +00:00
|
|
|
/** @type {import("./actions/send-event")} */
|
|
|
|
const sendEvent = sync.require("./actions/send-event")
|
2023-07-03 12:39:42 +00:00
|
|
|
/** @type {import("./converters/utils")} */
|
|
|
|
const utils = sync.require("./converters/utils")
|
|
|
|
|
2023-07-03 05:20:24 +00:00
|
|
|
|
2023-07-03 12:39:42 +00:00
|
|
|
sync.addTemporaryListener(as, "type:m.room.message",
|
2023-07-03 05:20:24 +00:00
|
|
|
/**
|
2023-07-03 12:39:42 +00:00
|
|
|
* @param {import("../types").Event.Outer<import("../types").Event.M_Room_Message>} event it is a m.room.message because that's what this listener is filtering for
|
2023-07-03 05:20:24 +00:00
|
|
|
*/
|
2023-07-03 12:39:42 +00:00
|
|
|
async event => {
|
|
|
|
if (utils.eventSenderIsFromDiscord(event.sender)) return
|
|
|
|
const messageResponses = await sendEvent.sendEvent(event)
|
2023-06-28 20:08:17 +00:00
|
|
|
})
|