Skip to content

Plugin/addon/mod for Discord. Adds panel that loads pictures via settings file with used files and links, allowing you to send pictures in chat with or without text by clicking on pictures preview on the panel. Settings file is automatically created on scanning the plugin folder or custom folder (supports subfolders and will show them as section…

License

Notifications You must be signed in to change notification settings

Japanese-Schoolgirl/DiscordPlugin-CustomPanelForSendingPictures

Repository files navigation

Introduction:

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 licence 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.

Plugin description

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).

Preview of the latest update:

Preview of the latest update

Work Example:

Work example 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:

Search bar:

Search bar

Configuration menu:

Configuration menu

Compatibility:

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.
Plugin also uses Zerebos' Plugin Library and gifsicle.
Performance on operating systems other than Windows was not tested, it is likely that some functionality may not works on a different OS.

Installation

  1. Install Powercord or BetterDiscord. For Powercord after installing you also need to install bdCompat to your Powercord's plugin folder (after this installation BetterDiscord Plugins tab will appear in Powercord section, also don't forget that plugins will be displayed only after Discord is reloaded);
  2. Place Zerebos' Plugin Library file into your plugin folder;
  3. Place plugin's ".js" file into your plugin folder;
  4. 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).

Support:

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.
If you'd like to help me financially and for some reason you didn't use "Sponsor" button for it, here are my requisites:
https://qiwi.com/n/TOUHOUSCHOOLGIRL
https://donate.qiwi.com/payin/Schoolgirl

Communication:

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.

Utilities:

  • 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.

TODO (and known issues):

(Some of these items are put on hold, because I wasn't able to find a way to "handle" sending messages)
— ".sent" files aren't generated automatically, it's caused by inability to get a link by sent file's ID (Dispatch method only returns ID of the channel, but not ID of the message, and it doesn't contain a file link in its properties; message itself doesn't match with event's information like file size and sometimes file name);
— 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;
— Even though the part with loading elements to the panel is done asynchronously and separately, visual freeze still happens (moreover it's random and very rare, usually after restarting Discord). Attempt at locating the issue with Performance debug haven't brought any result yet. Apparently the problem is related exclusively to large amount of files. Also after ~5 minutes time of Discord's work, the problem with freeze disappears;
— 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).

About

Plugin/addon/mod for Discord. Adds panel that loads pictures via settings file with used files and links, allowing you to send pictures in chat with or without text by clicking on pictures preview on the panel. Settings file is automatically created on scanning the plugin folder or custom folder (supports subfolders and will show them as section…

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project