Comparison of all the stuff I did. #6

Merged
Guzio merged 48 commits from fuckery into main 2026-03-02 15:17:09 +00:00
2 changed files with 13 additions and 2 deletions
Showing only changes of commit 42c32ba749 - Show all commits

View file

@ -346,7 +346,7 @@ const commands = [{
msgtype: "m.text",
body: "Unknown error occurred during thread creation. See error message below (or on the main channel, if the command was ran inside a thread) for details."
})
throw e_raw;
throw e_raw; //Has to be e_raw, as functions get stripped from e as part of unmarshaling Discord error
}
}
}

View file

@ -4,7 +4,7 @@ const assert = require("assert").strict
const Ty = require("../types")
const {tag} = require("@cloudrac3r/html-template-tag")
const passthrough = require("../passthrough")
const {db} = passthrough
const {db, select} = passthrough
const {reg} = require("./read-registration")
const userRegex = reg.namespaces.users.map(u => new RegExp(u.regex))
@ -398,6 +398,16 @@ async function setUserPowerCascade(spaceID, mxid, power, api) {
}
}
/**
* Set a user's power level for a whole room hierarchy.
* @param {string} eventID
*/
function getThreadRoomFromThreadMessage(eventID){
const threadID = select("event_message", "message_id", {event_id: eventID}).pluck().get() //Discord thread ID === its message ID
if (!threadID) return threadID;
return select("channel_room", "room_id", {channel_id: threadID}).pluck().get()
}
module.exports.bot = bot
module.exports.BLOCK_ELEMENTS = BLOCK_ELEMENTS
module.exports.eventSenderIsFromDiscord = eventSenderIsFromDiscord
@ -413,3 +423,4 @@ module.exports.removeCreatorsFromPowerLevels = removeCreatorsFromPowerLevels
module.exports.getEffectivePower = getEffectivePower
module.exports.setUserPower = setUserPower
module.exports.setUserPowerCascade = setUserPowerCascade
module.exports.getThreadRoomFromThreadMessage = getThreadRoomFromThreadMessage