Skip to content

Commit

Permalink
Added the option for registry_plugins_only (#3247)
Browse files Browse the repository at this point in the history
* Added the option for secure_plugins_only

* Change config name

* Forgot to update app.json

* Forgot a period. Thanks taku :(
  • Loading branch information
sebkuip authored Mar 8, 2023
1 parent b693b27 commit 8d41c1d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
"GITHUB_TOKEN": {
"description": "A github personal access token with the repo scope.",
"required": false
},
"REGISTRY_PLUGINS_ONLY": {
"description": "If set to true, only plugins that are in the registry can be loaded.",
"required": false
}
}
}
8 changes: 8 additions & 0 deletions cogs/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ async def parse_user_input(self, ctx, plugin_name, check_version=False):
plugin = Plugin(user, repo, plugin_name, branch)

else:
if not self.bot.config.get("registry_plugins_only", False):
embed = discord.Embed(
description="This plugin is not in the registry. "
"To install it, you must set `REGISTRY_PLUGINS_ONLY=false` in your .env file or config settings.",
color=self.bot.error_color,
)
await ctx.send(embed=embed)
return
try:
plugin = Plugin.from_string(plugin_name)
except InvalidPluginError:
Expand Down
2 changes: 2 additions & 0 deletions core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class ConfigManager:
"connection_uri": None, # replace mongo uri in the future
"owners": None,
"enable_presence_intent": False,
"registry_plugins_only": False,
# bot
"token": None,
"enable_plugins": True,
Expand Down Expand Up @@ -223,6 +224,7 @@ class ConfigManager:
"thread_show_join_age",
"use_hoisted_top_role",
"enable_presence_intent",
"registry_plugins_only",
}

enums = {
Expand Down

0 comments on commit 8d41c1d

Please sign in to comment.