zerebos / BDPluginLibrary

Plugin library for BetterDiscord.
MIT License
213 stars 139 forks source link

Version, Name, Description, Author, and UpdateURL from Plugin Metadata #73

Closed QbDesu closed 2 years ago

QbDesu commented 3 years ago

You probably have already thought about this yourself, I expect you would have: It would be nice to have the metadata in one place and preferably keep it to the metadata comment.

Like a plugin may have the following metadata comment:

/**
* @name MyPlugin
* @displayName My Plugin - I don't think this actually used by BD but I see it in a bunch of plugins
* @description A plugin that does things.
* @author Me
* @authorId <id>
* @version 1.0.0
* @invite <invite>
* @source https://github.com/[...]
* @updateUrl https://raw.githubusercontent.com/[...]
*/

But for update checking to work it needs to also pass the proper config when building the ZLibrary plugin.

const config = {
    info: {
        name: "MyPlugin",
        version: "1.0.0",
        github_raw: "https://raw.githubusercontent.com/[...]"
    },
    ...
};

This is assuming you explicitly remove the getAuthor and getDescription function from using something like, otherwise the plugin will not load.

this.getAuthor = null;
this.getDescription = null;

I don't know if you plan to deprecate update checking anyway and replace it with update checking using the store. Either way not having to specify the metadata like author, description, and name in code would be nice even if it you end up removing update checking. That would mean only adding the corresponding methods if the plugin supplies them as a config but or removing the functions if they don't (same same).

zerebos commented 3 years ago

I don't know if you plan to deprecate update checking anyway and replace it with update checking using the store.

At some point, yes.

Either way not having to specify the metadata like author, description, and name in code would be nice

As a developer, you don't have to explicitly do this if you build the plugin as described in the docs using the scripts in this repo (or in https://github.com/rauenzi/BetterDiscordAddons). You only write them once in the config.json and the build script handles the rest.