async def loadcons(): thing = [] capes = await loadcapes() for id in capes: x = cape.Cape(id, capes[id]) thing.append(x) return thing
async def fullhistory(self, ctx, *args): '''Reveal prior experiences of your cape ''' id = str(ctx.author.id) capes = await loadcapes() if id not in capes: await ctx.send("You don't have a cape.") return x = cape.Cape(id,capes[id]) await ctx.send("```" + x.history() + "```")
async def status(self, ctx, *args): '''Displays current status of your cape ''' id = str(ctx.author.id) capes = await loadcapes() if id not in capes: await ctx.send("You don't have a cape.") return x = cape.Cape(id,capes[id]) await ctx.send("```" + x.status() + "```")
async def addcape(self,ctx,*args): id = random.randint(0,10000) capes = await loadcapes() x = cape.Cape(id, None) x.pc = False x.givePlayer('None') entry = x.jsonDict() capes[id] = entry with open('autocape/capes.json', 'w+') as capefile: json.dump(capes, capefile) await ctx.send("```" + x.status() + "```") await ctx.send("Cape created.")
async def rename(self, ctx, *args): thing = str(ctx.author.id) capes = await loadcapes() if thing not in capes: await ctx.send("You don't have anyone to rename.") return x = cape.Cape(thing, capes[thing]) newAlias = '' for arg in args: newAlias += arg + ' ' newAlias = newAlias[:-1] x.alias = newAlias await x.updateCape() await ctx.send("Your cape is now named " + newAlias + ".")
async def history(self,ctx,*args): id = str(ctx.author.id) capes = await loadcapes() if id not in capes: await ctx.send("You don't have a cape.") return x = cape.Cape(id,capes[id]) final = '' shorten = x.history() shorten = shorten.splitlines() if len(shorten) >= 5: for z in range(0,5): final += shorten[len(shorten) - z - 1] final += "\n" await ctx.send("```" + final + "```") else: await ctx.send("```" + x.history() + "```")
async def gen(self, ctx, *args): '''Generate a cape for the autocape city ''' id = str(ctx.author.id) capes = await loadcapes() if id in capes: await ctx.send("You already have a cape.") return x = cape.Cape(str(ctx.author.id),None) x.pc = True x.givePlayer(ctx.author.display_name) entry = x.jsonDict() capes[id] = entry with open('autocape/capes.json', 'w+') as capefile: json.dump(capes, capefile) await ctx.send("```" + x.status() + "```") await ctx.send("Cape created.")