diff --git a/src/__init__.py b/src/__init__.py index dd592fd..693286b 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -6,7 +6,7 @@ Sebi-Machine. __author__ = 'Annihilator708' # TODO: add yourselves here. I can't remember everyones handles. -__contributors__ = (__author__, 'Neko404NotFound', 'Dusty.P') +__contributors__ = (__author__, 'Neko404NotFound', 'Dusty.P', 'davfsa') __license__ = 'MIT' __title__ = 'Sebi-Machine' __version__ = 'tbd' diff --git a/src/cogs/contributors.py b/src/cogs/contributors.py index 69aca0a..3e66d09 100644 --- a/src/cogs/contributors.py +++ b/src/cogs/contributors.py @@ -4,6 +4,7 @@ from discord.ext import commands import discord import traceback +import aiofiles class Upload: """ @@ -80,6 +81,39 @@ class Upload: await ctx.send(f'Could not unload `{extension}` -> `{e}`') else: await ctx.send(f'Loaded `{extension}`.') + + @commands.command() + async def permunload(self, ctx, extension=None): + """Disables permanently a cog.""" + await ctx.trigger_typing() + if ctx.author.id not in self.bot.ownerlist: + return await ctx.send('Only my contributors can use me like this :blush:', delete_after=10) + + if cog is None: + return await ctx.send("Please provide a extension. Do `help permunload` for more info") + + extension = extension.lower() + + async with aiofiles.open("extension.txt") as fp: + lines=fp.readlines() + + removed = False + async with aiofiles.open("extension.txt", "w") as fp: + for i in lines: + if i.replace("\n", "") != extension: + fp.write(i) + else: + removed = True + break + + if removed is True: + try: + self.bot.unload_extension(extension) + except: + pass + return await ctx.send("Extension removed successfully") + + await ctx.send("Extension not found") def setup(bot): - bot.add_cog(Upload(bot)) \ No newline at end of file + bot.add_cog(Upload(bot)) diff --git a/src/cogs.txt b/src/extensions.txt similarity index 100% rename from src/cogs.txt rename to src/extensions.txt