fix: media options for message
This commit is contained in:
parent
15443afe8d
commit
e102f62820
1 changed files with 5 additions and 4 deletions
|
|
@ -71,10 +71,11 @@ const sendMessage = async (req, res) => {
|
||||||
switch (contentType) {
|
switch (contentType) {
|
||||||
case 'string':
|
case 'string':
|
||||||
if (options?.media) {
|
if (options?.media) {
|
||||||
const media = options.media
|
const { mimetype, data, filename = null, filesize = null } = options.media
|
||||||
media.filename = null
|
if (!mimetype || !data) {
|
||||||
media.filesize = null
|
return sendErrorResponse(res, 400, 'invalid media options')
|
||||||
options.media = new MessageMedia(media.mimetype, media.data, media.filename, media.filesize)
|
}
|
||||||
|
options.media = new MessageMedia(mimetype, data, filename, filesize)
|
||||||
}
|
}
|
||||||
messageOut = await client.sendMessage(chatId, content, options)
|
messageOut = await client.sendMessage(chatId, content, options)
|
||||||
break
|
break
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue