Skip to content

Commit 8d41c1d

Browse files
authored
Added the option for registry_plugins_only (modmail-dev#3247)
* Added the option for secure_plugins_only * Change config name * Forgot to update app.json * Forgot a period. Thanks taku :(
1 parent b693b27 commit 8d41c1d

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

app.json

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
"GITHUB_TOKEN": {
3535
"description": "A github personal access token with the repo scope.",
3636
"required": false
37+
},
38+
"REGISTRY_PLUGINS_ONLY": {
39+
"description": "If set to true, only plugins that are in the registry can be loaded.",
40+
"required": false
3741
}
3842
}
3943
}

cogs/plugins.py

+8
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,14 @@ async def parse_user_input(self, ctx, plugin_name, check_version=False):
302302
plugin = Plugin(user, repo, plugin_name, branch)
303303

304304
else:
305+
if not self.bot.config.get("registry_plugins_only", False):
306+
embed = discord.Embed(
307+
description="This plugin is not in the registry. "
308+
"To install it, you must set `REGISTRY_PLUGINS_ONLY=false` in your .env file or config settings.",
309+
color=self.bot.error_color,
310+
)
311+
await ctx.send(embed=embed)
312+
return
305313
try:
306314
plugin = Plugin.from_string(plugin_name)
307315
except InvalidPluginError:

core/config.py

+2
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ class ConfigManager:
167167
"connection_uri": None, # replace mongo uri in the future
168168
"owners": None,
169169
"enable_presence_intent": False,
170+
"registry_plugins_only": False,
170171
# bot
171172
"token": None,
172173
"enable_plugins": True,
@@ -223,6 +224,7 @@ class ConfigManager:
223224
"thread_show_join_age",
224225
"use_hoisted_top_role",
225226
"enable_presence_intent",
227+
"registry_plugins_only",
226228
}
227229

228230
enums = {

0 commit comments

Comments
 (0)