WIP: feature: threads'n'forums #74
1 changed files with 3 additions and 13 deletions
|
|
@ -211,6 +211,7 @@ sync.addTemporaryListener(as, "type:m.room.message", guard("m.room.message",
|
||||||
*/
|
*/
|
||||||
async event => {
|
async event => {
|
||||||
if (utils.eventSenderIsFromDiscord(event.sender)) return
|
if (utils.eventSenderIsFromDiscord(event.sender)) return
|
||||||
|
if (await handleForums(event)) return
|
||||||
|
|
||||||
let processCommands = true
|
let processCommands = true
|
||||||
if (event.content["m.relates_to"]?.rel_type === "m.thread") {
|
if (event.content["m.relates_to"]?.rel_type === "m.thread") {
|
||||||
|
|
@ -229,19 +230,8 @@ async event => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
const messageResponses = await sendEvent.sendEvent(event)
|
||||||
const messageResponses = await sendEvent.sendEvent(event)
|
if (!messageResponses.length) return
|
||||||
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) {
|
if (event.type === "m.room.message" && event.content.msgtype === "m.text" && processCommands) {
|
||||||
await matrixCommandHandler.parseAndExecute(
|
await matrixCommandHandler.parseAndExecute(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue