Add basic sticker receiving support

No support for moderator replies with stickers.

If a user sends the bot a sticker, the thread will show
that sticker's name. Not all stickers can be linked to directly
(as they're not all regular images), so this feels like the
best compromise.
cshd
Dragory 2020-10-22 01:37:30 +03:00
parent f8f9204dac
commit 620ab79f71
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
1 changed files with 10 additions and 0 deletions

View File

@ -346,6 +346,16 @@ class Thread {
messageContent = messageContent.trim(); messageContent = messageContent.trim();
} }
if (msg.stickers && msg.stickers.length) {
const stickerLines = msg.stickers.map(sticker => {
return `*<Message contains sticker "${sticker.name}">*`;
});
messageContent += "\n\n" + stickerLines.join("\n");
}
messageContent = messageContent.trim();
// Save DB entry // Save DB entry
let threadMessage = new ThreadMessage({ let threadMessage = new ThreadMessage({
message_type: THREAD_MESSAGE_TYPE.FROM_USER, message_type: THREAD_MESSAGE_TYPE.FROM_USER,