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: extension and plugin loading system #43

Closed onerandomusername closed 3 years ago

onerandomusername commented 3 years ago

Description

Adds the ability to load extensions, and manage them.

Most of the code of the first commit is taken from this project, at that position in time.

Added

Fixed

Todo in later issues:

codecov[bot] commented 3 years ago

Codecov Report

Merging #43 (f708632) into main (a65e576) will decrease coverage by 54.59%. The diff coverage is 23.15%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main      #43       +/-   ##
===========================================
- Coverage   91.51%   36.92%   -54.60%     
===========================================
  Files           5       12        +7     
  Lines         283      520      +237     
  Branches        7       60       +53     
===========================================
- Hits          259      192       -67     
- Misses         20      323      +303     
- Partials        4        5        +1     
Impacted Files Coverage Δ
modmail/extensions/extension_manager.py 0.00% <0.00%> (ø)
modmail/extensions/meta.py 0.00% <0.00%> (ø)
modmail/extensions/plugin_manager.py 0.00% <0.00%> (ø)
modmail/plugin_helpers.py 0.00% <0.00%> (ø)
modmail/bot.py 43.05% <32.65%> (-21.05%) :arrow_down:
modmail/utils/plugins.py 39.53% <39.53%> (ø)
modmail/__main__.py 47.05% <50.00%> (-2.95%) :arrow_down:
modmail/utils/extensions.py 60.46% <60.46%> (ø)
modmail/utils/cogs.py 90.00% <90.00%> (ø)
modmail/__init__.py 100.00% <100.00%> (ø)
... and 9 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 a65e576...f708632. Read the comment docs.

onerandomusername commented 3 years ago

Still pending writing tests, but the rest of the pull looks ready.

Shivansh-007 commented 3 years ago

@onerandomusername @bast0006 What do you think of my review comment, of merging them into a base class and the two inheriting them?

bast0006 commented 3 years ago

@onerandomusername @bast0006 What do you think of my review comment, of merging them into a base class and the two inheriting them?

Yep. That's what I was thinking as well and mentioned in the wall of review somewhere. Honestly I think we don't need a base class, Plugin should just subclass Extension.

ShakyaMajumdar commented 3 years ago

The .env.template file should have descriptions for the variables not mentioned in CONTRIBUTING.md.

onerandomusername commented 3 years ago

The .env.template file should have descriptions for the variables not mentioned in CONTRIBUTING.md.

Addressed by removing vars which the bot does not currently use.

onerandomusername commented 3 years ago

Once @bast0006 re-reviews, I'm planning to merge this tomorrow.