1
0
Fork 0
out-of-your-element-fork-th.../d2m/converters/message-to-event.js

28 lines
597 B
JavaScript
Raw Normal View History

2023-04-25 20:06:08 +00:00
// @ts-check
const markdown = require("discord-markdown")
/**
* @param {import("discord-api-types/v10").APIMessage} message
* @returns {import("../../types").M_Room_Message_content}
*/
function messageToEvent(message) {
2023-04-25 20:06:08 +00:00
const body = message.content
const html = markdown.toHTML(body, {
2023-04-30 12:57:30 +00:00
/* discordCallback: {
2023-04-25 20:06:08 +00:00
user: Function,
channel: Function,
role: Function,
everyone: Function,
here: Function
2023-04-30 12:57:30 +00:00
} */
2023-04-25 20:06:08 +00:00
}, null, null)
return {
msgtype: "m.text",
body: body,
2023-04-30 12:57:30 +00:00
format: "org.matrix.custom.html",
2023-04-25 20:06:08 +00:00
formatted_body: html
}
}
module.exports.messageToEvent = messageToEvent