discord-modmail / modmail

A Modmail bot for Discord. Allowing safe moderator conversations with server members one server at a time.
https://discord-modmail.readthedocs.io/
MIT License
15 stars 8 forks source link

Feat/plugin install #69

Open onerandomusername opened 3 years ago

onerandomusername commented 3 years ago

depends on #74

Relevant Issues

Closes #54 Closes #62 Closes #63

Overview

Installation system for plugins. Portions of this may be used in the future for other addons, so nearly everything up to when the import is done should be in an addons.py utility file.

The currently supported type of repos are in zip format, using the following structure:

{{user}}/{{repo}}/Plugins/{{directory}}/{{files}}.py

This gives the advantage to be able to extend the addons api in the future without having to worry about the structure of the repo.

A sample repository is viewable here: onerandomusername/modmal-addons, with a clone to gitlab/onerandomusername/modmal-addons

Details

Provided a github or gitlab repo, parses it to get the specific plugin information, if it exists, from the plugin.toml file. The plugin.toml file is supplemental to the folders, meaning that the nature of the toml file existing does not override the existing plugins.

Rather than provide a list of all of the features here, I recommend checking out the documentation for this pull request, found here: https://discord-modmail.readthedocs.io/en/feat-plugin-install/addons/

codecov[bot] commented 3 years ago

Codecov Report

Merging #69 (9987b26) into main (4b07917) will decrease coverage by 3.98%. The diff coverage is 56.58%.

:exclamation: Current head 9987b26 differs from pull request most recent head bfba8e2. Consider uploading reports for the commit bfba8e2 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #69      +/-   ##
==========================================
- Coverage   70.90%   66.92%   -3.99%     
==========================================
  Files          33       44      +11     
  Lines        1619     2313     +694     
  Branches      199      321     +122     
==========================================
+ Hits         1148     1548     +400     
- Misses        439      717     +278     
- Partials       32       48      +16     
Impacted Files Coverage Δ
modmail/extensions/plugin_manager.py 30.08% <26.23%> (-39.48%) :arrow_down:
modmail/extensions/extension_manager.py 35.63% <31.08%> (+1.28%) :arrow_up:
modmail/bot.py 36.84% <31.57%> (-2.01%) :arrow_down:
modmail/addons/plugins.py 46.06% <46.06%> (ø)
modmail/addons/utils.py 51.72% <51.72%> (ø)
modmail/config.py 95.52% <60.00%> (-1.41%) :arrow_down:
modmail/utils/__init__.py 66.66% <66.66%> (ø)
modmail/errors.py 75.00% <75.00%> (ø)
modmail/addons/models.py 77.68% <77.68%> (ø)
modmail/utils/extensions.py 82.50% <81.81%> (-10.53%) :arrow_down:
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update df5dbb9...bfba8e2. Read the comment docs.

onerandomusername commented 3 years ago

This seems to be ready for review now.

onerandomusername commented 2 years ago

This pr is now feature frozen.

The bot not using the cached downloaded files will be resolved in a seperate pr.

dpulls[bot] commented 2 years ago

:tada: All dependencies have been resolved !

onerandomusername commented 2 years ago

This still depends on solving the docker problem, however the rest of the code can be review.

onerandomusername commented 2 years ago

Linting workflows are going to fail until this is merged with main again due to how github merges then and a dependency mismatch. Given that there's so many merge commits already, I'm holding off on a merge until later.

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-2.2%) to 70.798% when pulling bfba8e2b60ae413202378ab155057ce8e6dec4e4 on feat/plugin-install into df5dbb94a904d8aab73a12d1e968cd8eaca88227 on main.