generated from lucien/api-template
add: added image attachments to messages
This commit is contained in:
parent
8f77a271e1
commit
fb90f1ef4f
10 changed files with 169 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
const express = require('express');
|
||||
const { getConnection, getLastMessages, getMentions } = require('../libs/mysql');
|
||||
const { getConnection, getLastMessages, getMentions, getMessageAttachments } = require('../libs/mysql');
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
|
@ -15,6 +15,12 @@ router.get('/', async (req, res) => {
|
|||
message.mentions = [];
|
||||
}
|
||||
message.replies = [];
|
||||
if (message.has_attachments) {
|
||||
const attachments = await getMessageAttachments(connection, message.id);
|
||||
message.attachments = attachments;
|
||||
} else {
|
||||
message.attachments = [];
|
||||
}
|
||||
}
|
||||
|
||||
connection.end();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue