This plugin was written for my own use and for people I'm communicating with. But since plugin can be useful for someone else I'm uploading it here. In case you want to rewrite this plugin (and considering my inexperience, you probably should) also check the license file.
P.S. I rarely use GitHub, so it is my first time in dealing with such a project. Don't be surprised about some weirdness regarding commits etc. Also my native language isn't English so there may be mistakes in wording.
This plugin adds a special "Pictures" button to the right of Emojis selection button. Clicking that button will load a panel which's contents are loaded from special folder that is created by this plugin. The folder is scanned for files of the following types: ".jpg", ".jpeg", ".bmp", ".png", ".webp", ".gif", ".src", ".sent".
Files of ".src" and ".sent" types are JSON files and contain a link to the web file (content example: "https://i.imgur.com/l5Jf0VP.png").
After the scan the panel will show previews of all your files in the folder. After clicking a file in this panel you'll immediately send a picture file (or a link of picture in case of ".src" and ".sent") to currently opened Discord chat.
Files of ".sent" type will replace files with identical name and extension. ".sent" files will be automatically generated after sending local files and will be used if you have enabled corresponding setting.
Starting from version 0.0.7 this plugin will search for and scan subfolders placed in the main folder. Content of these folders will be displayed as sections/groups in the panel itself. Subfolders inside subfolders will not be scanned. It is also not recommended to store 300+ images as it will affect speed of panel loading (file size doesn't matter).
Changes not displayed in the gif above: improved buttons design, added 1 new button (opens Main folder) in the pictures panel, added asynchronous pictures loading to the panel, added displaying error handler when loading local or web files failed, added an option for automatic proportional scaling of pictures from local or web files to set size.
Also search through pictures was added and it is shown in the gif below:
Plugin should be completely compatible with native and any of user themes, as it uses default Discord colour variables.
I use BetterDiscord and can only track problems that appears there.
The plugin uses external library gifsicle-wasm-browser to resize gifs.
Performance on operating systems other than Windows was not tested, it is likely that some functionality may not works on a different OS.
- Install BetterDiscord;
- Place plugin's ".js" file into your plugin folder;
- After enabling the plugin, it will create a new folder in your plugin folder, in which you need to move images that you want to use.
P.S. Plugin will save all information about folder's contents in CustomPanelForSendingPictures.settings.json file, and your plugin configuration in CustomPanelForSendingPictures.configuration.json (you can also delete those files to reset all settings).
If you'd want to help me with this janky project, check the TODO, where I've listed problems that I'm trying to solve at the moment. You can check Communication section for ways of contacting me.
I don't accept unknown friend requests, so if you want to DM me in Discord there is a huge chance I won't notice you. It's better to use GitHub or Steam to contact me (its not necessary to add me, I have open comment section). I also have Discord Server, but it has a manual approval of every user before they are allowed to write or read most of conversation channels. You can also try to write me on Twitch, but it's not the most convenient way.
- Changelog;
- To resize pictures and compress them to a smaller size in selected folder (to optimize your pictures list more), you can use FastStone Photo Resizer (better to not compress gifs with this program) or similar;
- There is an archive with some of previously global emojis saved, if you need to add more pictures.
(Some of these items are put on hold, because I wasn't able to find a way to "handle" sending messages)
— Fix the option for sending message before file, which sends messages without the markdown;
— Fix sending images and messages in a not opened message's thread. At the moment, images and messages are only sent to Discord's opened channel;
— Fix sending images and messages in reply. These are sent as a normal message;
— Add support for proportional scaling of animated .png (.apng) and .webp files (this task has low priority since Discord cannot properly display them at the moment).