1
0
Fork 0

Use the proper L1 and L2 emojis

This commit is contained in:
Cadence Ember 2023-10-08 00:00:34 +13:00
parent 3ef569d855
commit af274ede53
3 changed files with 10 additions and 3 deletions

1
db/orm-defs.d.ts vendored
View file

@ -86,6 +86,7 @@ export type Models = {
export type Prepared<Row> = { export type Prepared<Row> = {
pluck: () => Prepared<Row[keyof Row]> pluck: () => Prepared<Row[keyof Row]>
safeIntegers: () => Prepared<{[K in keyof Row]: Row[K] extends number ? BigInt : Row[K]}> safeIntegers: () => Prepared<{[K in keyof Row]: Row[K] extends number ? BigInt : Row[K]}>
raw: () => Prepared<Row[keyof Row][]>
all: (..._: any[]) => Row[] all: (..._: any[]) => Row[]
get: (..._: any[]) => Row | null get: (..._: any[]) => Row | null
} }

View file

@ -316,11 +316,12 @@ async function eventToMessage(event, guild, di) {
if (!repliedToEventId) return if (!repliedToEventId) return
let repliedToEvent = await di.api.getEvent(event.room_id, repliedToEventId) let repliedToEvent = await di.api.getEvent(event.room_id, repliedToEventId)
if (!repliedToEvent) return if (!repliedToEvent) return
// @ts-ignore
const autoEmoji = new Map(select("auto_emoji", ["name", "emoji_id"], {}, "WHERE name = 'L1' OR name = 'L2'").raw().all())
replyLine = `<:L1:${autoEmoji.get("L1")}><:L2:${autoEmoji.get("L2")}>`
const row = from("event_message").join("message_channel", "message_id").select("channel_id", "message_id").where({event_id: repliedToEventId}).and("ORDER BY part").get() const row = from("event_message").join("message_channel", "message_id").select("channel_id", "message_id").where({event_id: repliedToEventId}).and("ORDER BY part").get()
if (row) { if (row) {
replyLine = `<:L1:1144820033948762203><:L2:1144820084079087647>https://discord.com/channels/${guild.id}/${row.channel_id}/${row.message_id} ` replyLine += `https://discord.com/channels/${guild.id}/${row.channel_id}/${row.message_id} `
} else {
replyLine = `<:L1:1144820033948762203><:L2:1144820084079087647>`
} }
const sender = repliedToEvent.sender const sender = repliedToEvent.sender
const senderName = sender.match(/@([^:]*)/)?.[1] || sender const senderName = sender.match(/@([^:]*)/)?.[1] || sender

View file

@ -89,4 +89,9 @@ INSERT INTO member_cache (room_id, mxid, displayname, avatar_url) VALUES
('!BnKuBPCvyfOkhcUjEu:cadence.moe', '@cadence:cadence.moe', 'cadence [they]', 'mxc://cadence.moe/azCAhThKTojXSZJRoWwZmhvU'), ('!BnKuBPCvyfOkhcUjEu:cadence.moe', '@cadence:cadence.moe', 'cadence [they]', 'mxc://cadence.moe/azCAhThKTojXSZJRoWwZmhvU'),
('!maggESguZBqGBZtSnr:cadence.moe', '@cadence:cadence.moe', 'cadence [they]', 'mxc://cadence.moe/azCAhThKTojXSZJRoWwZmhvU'); ('!maggESguZBqGBZtSnr:cadence.moe', '@cadence:cadence.moe', 'cadence [they]', 'mxc://cadence.moe/azCAhThKTojXSZJRoWwZmhvU');
INSERT INTO "auto_emoji" ("name","emoji_id","guild_id") VALUES
('L1','1144820033948762203','529176156398682115'),
('L2','1144820084079087647','529176156398682115'),
('_','_','529176156398682115');
COMMIT; COMMIT;