async def requests(ctx): id = ctx.author.id if dbmanager.checkOwner(id): request = ally.isRequested(id) if not request: await ctx.send("No requests") else: await ctx.send(request) else: await ctx.send( 'You must own a kingdom before you can perform this action!')
async def createkingdom(ctx, name=None): ownerid = ctx.author.id if name: if dbmanager.checkOwner(ownerid) == False: if dbmanager.checkExist(name) == False: dbmanager.createKingdom(name, ctx.author.name, ctx.author.id) await ctx.send('{} has created a kingdom named: {}'.format( ctx.author.name, name)) else: await ctx.send( 'It appears a clan with that name already exists!') else: await ctx.send('Sorry dude you already own a kingdom!') else: await ctx.send('Please provide a name!')
async def unally(ctx, clanname=None): id = ctx.author.id if clanname: if dbmanager.checkOwner(id): if dbmanager.checkExist(clanname): if ally.checkAlly(id, clanname): await ctx.send(ally.removeAlly(id, clanname)) else: await ctx.send( 'You must be allied with {} to unally them!'.format( clanname)) else: await ctx.send( 'It appears the clan you wish to unally does not exist!') else: await ctx.send( 'You must own a kingdom before performing this action!') else: await ctx.send('Provide a clan to unally!')
async def raid(ctx, clantoraid=None): id = ctx.author.id if clantoraid: if dbmanager.checkExist(clantoraid): if dbmanager.checkOwner(id): if ally.checkAlly(id, clantoraid): await ctx.message.guild.get_member( dbmanager.getKingdomOwnerId(clantoraid) ).send("Your ally as attempted to raid you!") await ctx.send( 'You cannot raid an ally! I have notified your ally that you tried to raid them!' ) else: await ctx.send(raid.startRaid(id, clantoraid)) else: await ctx.send( 'You must own a kingdom to raid another kingdom!') else: await ctx.send( 'It appears the kingdom you are trying to raid does not exist!' ) else: await ctx.send('Please supply a kingdom you wish to raid!')
async def ally(ctx, a=None): id = ctx.author.id if a: if dbmanager.checkExist(a): if dbmanager.checkOwner(id): if ally.hasRequest(a): if ally.addAlly(id, a): await ctx.send( 'Alliance request sent, tell the clan {} to accept your request!' .format(a)) else: await ctx.send( 'So uh, something went wrong, please contact Flaymed immediatly.' ) else: await ctx.send( 'Tell this clan to clear their requests before you request an alliance again!' ) else: await ctx.send('You must own a clan to ally another clan.') else: await ctx.send('The clan you wish to ally does not exist.') else: await ctx.send('Please specify a clan to ally.')