Skip to content

Commit c94ae55

Browse files
committed
Bot populates plugin registry from github directly
1 parent 8bee7ca commit c94ae55

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cogs/plugins.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import sys
99
import json
1010
from pkg_resources import parse_version
11+
import random
1112

1213
import discord
1314
from discord.ext import commands
@@ -36,9 +37,14 @@ class Plugins(commands.Cog):
3637
"""
3738
def __init__(self, bot):
3839
self.bot = bot
40+
self.registry = {}
3941
self.bot.loop.create_task(self.download_initial_plugins())
40-
with open('plugins/registry.json') as f:
41-
self.registry = json.load(f)
42+
self.bot.loop.create_task(self.populate_registry())
43+
44+
async def populate_registry(self):
45+
url = 'https://raw.githubusercontent.com/kyb3r/modmail/master/plugins/registry.json'
46+
async with self.bot.session.get(url) as resp:
47+
self.registry = json.loads(await resp.text())
4248

4349
@staticmethod
4450
def _asubprocess_run(cmd):

0 commit comments

Comments
 (0)