Fix unbridging procedure

This commit is contained in:
Cadence Ember
2025-11-28 17:20:44 +13:00
parent 42beb6d249
commit 6d0a98eb49
2 changed files with 5 additions and 4 deletions

View File

@@ -437,7 +437,7 @@ async function unbridgeChannel(channelID) {
async function unbridgeDeletedChannel(channel, guildID) {
const roomID = select("channel_room", "room_id", {channel_id: channel.id}).pluck().get()
assert.ok(roomID)
const row = from("guild_space").join("guild_active", "guild_id").select("space_id", "autocreate").get()
const row = from("guild_space").join("guild_active", "guild_id").select("space_id", "autocreate").where({guild_id: guildID}).get()
assert.ok(row)
let botInRoom = true
@@ -461,7 +461,7 @@ async function unbridgeDeletedChannel(channel, guildID) {
// delete webhook on discord
const webhook = select("webhook", ["webhook_id", "webhook_token"], {channel_id: channel.id}).get()
if (webhook) {
await discord.snow.webhook.deleteWebhook(webhook.webhook_id, webhook.webhook_token)
await discord.snow.webhook.deleteWebhook(webhook.webhook_id, webhook.webhook_token).catch(() => {})
db.prepare("DELETE FROM webhook WHERE channel_id = ?").run(channel.id)
}

View File

@@ -7,6 +7,7 @@
const util = require("util")
const Ty = require("../types")
const {discord, db, sync, as, select} = require("../passthrough")
const {tag} = require("@cloudrac3r/html-template-tag")
/** @type {import("./actions/send-event")} */
const sendEvent = sync.require("./actions/send-event")
@@ -121,10 +122,10 @@ async function sendError(roomID, source, type, e, payload) {
// Where
const stack = stringifyErrorStack(e)
builder.addLine(`Error trace:\n${stack}`, `<details><summary>Error trace</summary><pre>${stack}</pre></details>`)
builder.addLine(`Error trace:\n${stack}`, tag`<details><summary>Error trace</summary><pre>${stack}</pre></details>`)
// How
builder.addLine("", `<details><summary>Original payload</summary><pre>${util.inspect(payload, false, 4, false)}</pre></details>`)
builder.addLine("", tag`<details><summary>Original payload</summary><pre>${util.inspect(payload, false, 4, false)}</pre></details>`)
}
// Send