fix m->d message deletions

This commit is contained in:
Cadence Ember 2023-10-02 22:10:50 +13:00
parent 708955c062
commit 53baeb5df7
2 changed files with 4 additions and 7 deletions

View file

@ -2,11 +2,7 @@
## Known issues
- d->m emojis do not work at all (inline chat, single emoji size, reactions, bridged state)
- d->m embeds
- m->d code blocks have slightly too much spacing
- m->d deletions
- removing reactions
- rooms will be set up even if the bridge does not have permission for the channels, which breaks when it restarts and tries to fetch messages
- test private threads as part of this
- solution part 1: calculate the permissions to see if the bot should be able to do stuff

View file

@ -12,9 +12,10 @@ const utils = sync.require("../converters/utils")
* @param {Ty.Event.Outer_M_Room_Redaction} event
*/
async function deleteMessage(event) {
const row = from("event_message").join("message_channel", "message_id").select("channel_id", "message_id").and("WHERE event_id = ?").get(event.event_id)
if (!row) return
return discord.snow.channel.deleteMessage(row.channel_id, row.message_id, event.content.reason)
const rows = from("event_message").join("message_channel", "message_id").select("channel_id", "message_id").and("WHERE event_id = ?").all(event.redacts)
for (const row of rows) {
discord.snow.channel.deleteMessage(row.channel_id, row.message_id, event.content.reason)
}
}
/**