WIP: feature: threads'n'forums #74

Draft
Guzio wants to merge 109 commits from Guzio/out-of-your-element:mergable-fr-fr into main
Showing only changes of commit d52794e22c - Show all commits

View file

@ -211,6 +211,7 @@ sync.addTemporaryListener(as, "type:m.room.message", guard("m.room.message",
*/
async event => {
if (utils.eventSenderIsFromDiscord(event.sender)) return
if (await handleForums(event)) return
let processCommands = true
if (event.content["m.relates_to"]?.rel_type === "m.thread") {
@ -229,19 +230,8 @@ async event => {
}
}
try {
const messageResponses = await sendEvent.sendEvent(event)
if (!messageResponses.length) return
}
catch (e){ //This had to have been caught outside the regular guard()->sendError() loop, otherwise commands wouldn't get processed.
if (e.message?.includes("220001")) { //see: https://docs.discord.com/developers/topics/opcodes-and-status-codes
if(!event.content.body.startsWith("/thread")) api.sendEvent(event.room_id, "m.room.message", {
msgtype: "m.text",
body: "You cannot send regular messages in rooms bridged to forum channels! Please create a /thread instead."
})
}
else throw e
}
if (event.type === "m.room.message" && event.content.msgtype === "m.text" && processCommands) {
await matrixCommandHandler.parseAndExecute(