Constrain ghost PLs to the main bridge bot's PL

This commit is contained in:
2025-06-23 06:35:50 +02:00
committed by h7x4
parent 653e38a9d2
commit 1c0c545a02

View File

@@ -218,7 +218,12 @@ function _hashProfileContent(content, powerLevel) {
async function syncUser(user, member, channel, guild, roomID) {
const mxid = await ensureSimJoined(user, roomID)
const content = await memberToStateContent(user, member, guild.id)
const powerLevel = memberToPowerLevel(user, member, guild, channel)
const discordPowerLevel = memberToPowerLevel(user, member, guild, channel)
const powerLevelsStateContent = await api.getStateEvent(roomID, "m.room.power_levels", "") // Kind of sucks we have to do this all the time
const botpl = powerLevelsStateContent.users?.[`@${reg.sender_localpart}:${reg.ooye.server_name}`] || 0
const powerLevel = Math.min(discordPowerLevel, botpl)
await _sendSyncUser(roomID, mxid, content, powerLevel, {
// do not overwrite pre-existing data if we already have data and `member` is not accessible, because this would replace good data with bad data
allowOverwrite: !!member,