Add new WHERE feature to my funny orm

This commit is contained in:
Cadence Ember 2023-10-06 12:31:10 +13:00
parent 28abdac5b6
commit 475cd5b724
30 changed files with 149 additions and 105 deletions

View file

@ -43,7 +43,7 @@ async function uploadDiscordFileToMxc(path) {
}
// Has this file already been uploaded in the past? Grab the existing copy from the database.
const existingFromDb = select("file", "mxc_url", "WHERE discord_url = ?").pluck().get(urlNoExpiry)
const existingFromDb = select("file", "mxc_url", {discord_url: urlNoExpiry}).pluck().get()
if (typeof existingFromDb === "string") {
return existingFromDb
}

View file

@ -151,7 +151,7 @@ const commands = [{
async (event, realBody, ctx) => {
// Guard
/** @type {string} */ // @ts-ignore
const channelID = select("channel_room", "channel_id", "WHERE room_id = ?").pluck().get(event.room_id)
const channelID = select("channel_room", "channel_id", {room_id: event.room_id}).pluck().get()
const guildID = discord.channels.get(channelID)?.["guild_id"]
let matrixOnlyReason = null
const matrixOnlyConclusion = "So the emoji will be uploaded on Matrix-side only. It will still be usable over the bridge, but may have degraded functionality."