sublime fkt but everything working
This commit is contained in:
1 parent
b655adc305
commit
66228047f4
12 files changed
+363
-123
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import type { PrismaClient, Attachment, Meme } from '@prisma/client';
|
||||
|
||||
import * as attachments from './attachments'
|
||||
|
||||
function memeUrl(a: Attachment) {
|
||||
const STORAGE_URL = process.env.STORAGE_URL
|
||||
const path = attachments.objectName(a)
|
||||
const u = new URL(path, `https://${STORAGE_URL}`)
|
||||
return u.href
|
||||
}
|
||||
|
||||
export function fromAttachment(a: Attachment) {
|
||||
const text = a.vision.fullTextAnnotation?.text || ''
|
||||
const tags = [
|
||||
a.guild.name,
|
||||
a.channel.name,
|
||||
a.message.author.username,
|
||||
]
|
||||
|
||||
const m: Meme = {
|
||||
id: a.memeId,
|
||||
url: memeUrl(a),
|
||||
text,
|
||||
tags: tags,
|
||||
attachmentId: a.id,
|
||||
createdAt: undefined,
|
||||
updatedAt: undefined
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
Reference in new issue
Block a user