Closed longnguyen2004 closed 9 months ago
Thank you.
if (blob.size > (55 * 1024)) {
callback(url); // Image size is larger than 25kb.
return;
}
The inline comment about 25kb was legacy. I increased the limit to 55-kb, and forgot to change the comment.
I'm fine with leaving it as 25kb, but just note that if an image is restricted or gets deleted, and its larger than 25-kb, the link might not be viewable outside of Discord or at a later date. If the limit it too big though, it won't send.
As well, I see you set id=mid, which is fine, however unless you want the Discord message ID for some reason, it's unneeded. The extension itself will auto-assign a sequential ID later on if there is no message ID, avoiding the chance for duplicate IDs for messages. Not an issue with Discord, given the size of their message IDs, but if you want the discord message ID passed along, i might instead consider adding in a new field for original message IDs instead.
I added the ID because of https://github.com/steveseguin/social_stream/blob/0d0c781b755e28990da71ff038c15240bb34e1da/discord.js#L169-L171
If the same user sends a message with the same text/sticker again, the data
object for the second message will be the same as the first, which causes the code to incorrectly drop the second message.
I see that the original fix is for Zoom though, so if Discord no longer has the same issue then we can remove it.
ah, okay. Thank you. Your solution works, so I'll leave it for now.
if (highestMessage>lastMessageID){lastMessageID = highestMessage;}
I might be checking for dupes using message ID in discord already, so that JSON check is probably not needed if you want to allow multiple sticker posts. The only reason why it might be useful is if sending a message; sometimes these sites will post the OG message, and then once its sent, delete it and repost it as a new message, with a new message ID.
Anyways, I'll leave it all for now, and address if there's issues later on. Thank you,
Title should be self-explanatory.
I've also noticed some...code clarity improvement opportunities, but those will have to wait for another PR.