-
Notifications
You must be signed in to change notification settings - Fork 9
feat: extension and plugin loading system #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
cogs will now load or not load depending on current bot mode. - all cogs now require a variable named "COG_METADATA" which is an instance of "CogMetadata" from "modmail.utils.cogs" - if a cog does not have it a warning will be logged and will assume that the cog should be loaded. - there are two modes, development mode and plugin dev mode - development mode can be set with DEVEL=True in environment variables - plugin dev mode can be set with PLUGIN_DEV=True - by defalt, both modes are false.
Shivansh-007
requested changes
Aug 5, 2021
cogs that load all the time were not loading all of the time, specifically when no mode was explicitly set.
93f5a58 to
01d6e96
Compare
- modify the plugins walk to ensure that it scans symlinked folders for development, plugins will most likely be symlinked from a folder where they are developed, part of their git repo, and linked into the bot's plugin folder.
Shivansh-007
approved these changes
Aug 12, 2021
bast0006
requested changes
Aug 12, 2021
Originally when you would resync the cogs, it would check
whether `(ext, status)` is present in the extensions which
is a dict. But this would always return `False`, for example
```pycon
a = {"a": "a"}
>>> print(("a", "a") in a)
False
```
A fix to this, as committed is to just check whether `ext`
is present in the extension keys.
075b807 to
662872b
Compare
Contributor
Author
|
Once @bast0006 re-reviews, I'm planning to merge this tomorrow. |
bast0006
previously requested changes
Aug 13, 2021
84768f2 to
eddbf3a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
l: intermediate
p: high
High Priority
s: approved
The issue has received a maintainer's approval
s: needs review
Ready for review and merge
t: feature
Relating to the functionality of the application.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
PROD: the default mode, no dev extensions or dev plugins loadDEVELOP: the bot developer mode, most useful for people adding features to modmailPLUGIN_DEV: the plugin developer mode, useful for enabling plugin-specific featuresmodmail/extensionsfolder and loads them if they are of the right format.modmail/pluginsfolder and loads them.extcommand for more details when the bot is inDEVELOPmode.pluginscommand for more details.modmail/plugin_helpers.pycontains several helpers for making pluginsPluginCogModmailBot, imported frommodmail.botModmailLogger, imported frommodmail.logFixed
Todo in later issues: