@baris thanks. I realised there's some issues with redactor munging the data.
When code is insered inside a <pre/> block, switching between HTML and WYSIWYG views will munge the content to HTML entitites.
You can recreate this issue on this page: http://imperavi.com/redactor/examples/typography/
Switch to code view and add some HTML inside the <pre/> block. I entered:
Switch to WYSIWYG and back to code and it has been replaced by:
This breaks the ability to parse that code later with syntax highlighters.
A main object and 3 sets as I said, nothing complex (in fact working with sets is pretty easy) but a bit confusing.
When I save or update the main object I have to also call 3 times db.setAdd() or db.setRemove() depending on vote type (upvote, downvote or undo) but thats all.
Still new to NodeBB, but I think the chat is handled by Redis/MongoDB. While you can store files in MongoDB using GridFS, I would think a great way to tackle that would be to have the plugin upload the file to storage (like AWS S3) and then include in the body of the message a link to the downloaded file. Permissions could be set at upload to only allow members of the chat access to the file.