diff --git a/app/modules/msc_getter.py b/app/modules/msc_getter.py index e3a3cbe..81bd537 100644 --- a/app/modules/msc_getter.py +++ b/app/modules/msc_getter.py @@ -194,13 +194,12 @@ class MSCGetter(niobot.Module): @niobot.command("msc.cache") @niobot.is_owner() - async def msc_cache_manager(self, ctx: niobot.Context, *args): + async def msc_cache_manager(self, ctx: niobot.Context, operation: str, arg1: str = None): """ MSC Cache manager Available commands: get, download, remove, clear, list """ - operation, *args = args if operation == "list": known = [] total_size = 0 @@ -226,7 +225,7 @@ class MSCGetter(niobot.Module): ) ) elif operation in ["get", "view"]: - file = self.msc_cache / ("{:0>4}.json".format(int(args[0]))) + file = self.msc_cache / ("{:0>4}.json".format(int(arg1))) if file.exists(): data = json.loads(file.read_text()) out = json.dumps(data, indent=4) @@ -235,12 +234,12 @@ class MSCGetter(niobot.Module): ) return await ctx.respond("%s does not exist." % file.name) elif operation in ["download", "dl", "fetch"]: - x = await self.get_msc_with_cache(int(args[0])) + x = await self.get_msc_with_cache(int(arg1)) return await ctx.respond( "```json\n%s\n```" % json.dumps(x, indent=4) ) elif operation in ["delete", "remove", "rm", "del"]: - file = self.msc_cache / ("{:0>4}.json".format(int(args[0]))) + file = self.msc_cache / ("{:0>4}.json".format(int(arg1))) if file.exists(): file.remove() return await ctx.respond("Removed cached file %s." % file.name)