async def resurrect(self, ctx): """Restore life to the bot. What magic is this?""" # Check for role requirements requiredRole = self.settings.getServerStat(ctx.guild, "RequiredKillRole") if requiredRole == "": #admin only if not await Utils.is_admin_reply(ctx): return else: #role requirement if not any(x for x in ctx.author.roles if str(x.id) == str( requiredRole)) and not Utils.is_admin(ctx): return await ctx.send( "You do not have sufficient privileges to access this command." ) iskill = self.settings.getServerStat(ctx.guild, "Killed") if not iskill: return await ctx.send( 'Trying to bring back the *already-alive* - well aren\'t you special!' ) self.settings.setServerStat(ctx.guild, "Killed", False) self.settings.setServerStat(ctx.guild, "Hunger", "0") killedBy = self.settings.getServerStat(ctx.guild, "KilledBy") killedBy = DisplayName.memberForID(killedBy, ctx.guild) await ctx.send( 'Guess who\'s back??\n\n*{}* may have tried to keep me down - but I *just keep coming back!*' .format(DisplayName.name(killedBy)))
async def message(self, message): # Check the message and see if we should allow it ctx = await self.bot.get_context(message) if not ctx.guild: # Don't restrict in pm return if not ctx.command: # No command - no need to check return # Get the list of blocked commands dis_com = self.settings.getServerStat(ctx.guild, "DisabledCommands") if ctx.command.name in dis_com: # Check if we're going to override admin_allow = self.settings.getServerStat(ctx.guild, "AdminDisabledAccess") badmin_allow = self.settings.getServerStat(ctx.guild, "BAdminDisabledAccess") # Check if we're admin and bot admin is_admin = Utils.is_admin(ctx) is_badmin = Utils.is_bot_admin_only(ctx) # Check if we override if (is_admin and admin_allow) or (is_badmin and badmin_allow): return # React if needed to_react = self.settings.getServerStat(ctx.guild, "DisabledReactions") if to_react: await message.add_reaction("🚫") # We have a disabled command - ignore it return {'Ignore': True, 'Delete': False}
async def kill(self, ctx): """Kill the bot... you heartless soul.""" # Check for role requirements requiredRole = self.settings.getServerStat(ctx.guild, "RequiredKillRole") if requiredRole == "": #admin only if not await Utils.is_admin_reply(ctx): return else: #role requirement if not any(x for x in ctx.author.roles if str(x.id) == str( requiredRole)) and not Utils.is_admin(ctx): return await ctx.send( "You do not have sufficient privileges to access this command." ) iskill = self.settings.getServerStat(ctx.guild, "Killed") if iskill: killedby = self.settings.getServerStat(ctx.guild, "KilledBy") killedby = DisplayName.memberForID(killedby, ctx.guild) return await ctx.send( 'I am *already* kill...\n\n*{}* did it...'.format( DisplayName.name(killedby))) self.settings.setServerStat(ctx.guild, "Killed", True) self.settings.setServerStat(ctx.guild, "KilledBy", author.id) await ctx.send('I am kill...\n\n*{}* did it...'.format( DisplayName.name(ctx.author)))
async def _can_run(self, ctx, reply=True): # Check if we're admin - and if not, check if bot admins can run this # and if we're bot admin if Utils.is_admin(ctx): return True if self.settings.getServerStat(ctx.guild,"BotAdminAsAdmin",False) and Utils.is_bot_admin_only(ctx): return True msg = "┐( ̄ヘ ̄;)┌\nKamu tidak memiliki hak untuk menggunakan command ini." em = discord.Embed(color = 0XFF8C00, description = msg) em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url)) if reply: await ctx.send(embed = em) return False
async def kill(self, ctx): """Bunuh botnya(Admin-server only) Dasar manusia tidak punya perasaan!""" # Check for role requirements requiredRole = self.settings.getServerStat(ctx.guild, "RequiredKillRole") # isOwner = self.settings.isOwner(ctx.author) # if isOwner == False: # msgText = ["Hus hus..\nFitur ini sedang dalam tahap pengambangan"] # msg = random.choice(msgText) # return await ctx.send(msg) if requiredRole == "": #admin only if not await Utils.is_admin_reply(ctx): return else: #role requirement if not any(x for x in ctx.author.roles if str(x.id) == str( requiredRole)) and not Utils.is_admin(ctx): em = discord.Embed( color=0XFF8C00, description= "> ┐( ̄ヘ ̄;)┌\n> Kamu tidak memiliki izin untuk menggunakan command ini" ) em.set_author( name="⚠ ADMIN ONLY", icon_url= "https://cdn.discordapp.com/attachments/518118753226063887/725569194304733435/photo.jpg" ) em.set_footer(text="Request by : {}".format(ctx.author.name), icon_url="{}".format(ctx.author.avatar_url)) return await ctx.send(embed=em) iskill = self.settings.getServerStat(ctx.guild, "Killed") if iskill: killedby = self.settings.getServerStat(ctx.guild, "KilledBy") killedby = DisplayName.memberForID(killedby, ctx.guild) msg = 'Aku telah dibunuh...\n*{}* Pelakunya...'.format( DisplayName.name(killedby)) em = discord.Embed(color=0XFF8C00, description="{}".format(msg)) em.set_footer(text="{}#{}".format(ctx.author.name, ctx.author.discriminator), icon_url="{}".format(ctx.author.avatar_url)) return await ctx.send(embed=em) self.settings.setServerStat(ctx.guild, "Killed", True) self.settings.setServerStat(ctx.guild, "KilledBy", author.id) msg = 'Aku telah dibunuh...\n*{}* Pelakunya...'.format( DisplayName.name(ctx.author.mention)) em = discord.Embed(color=0XFF8C00, description="{}".format(msg)) em.set_footer(text="{}#{}".format(ctx.author.name, ctx.author.discriminator), icon_url="{}".format(ctx.author.avatar_url)) await ctx.send(embed=em)
async def _can_run(self, ctx, reply=True): # Check if we're admin - and if not, check if bot admins can run this # and if we're bot admin if Utils.is_admin(ctx): return True if self.settings.getServerStat(ctx.guild, "BotAdminAsAdmin", False) and Utils.is_bot_admin_only(ctx): return True if reply: await ctx.send( "You do not have sufficient privileges to access this command." ) return False
async def drbeer(self, ctx): """Put yourself in your place.""" if not Utils.is_admin(ctx): return beerList = ["Hey, yall. Quit ya horsin' around now. Can't you see I'm busy tryin'a shoot'n all them summersquash?", "Now I don't know how to use all them 5-dollah words y'all sprayin' around, but sure seems to me like y'all need to mind your peas and queues.", "As long as I can keep practicin' and protectin' all my favorite amendments, like the second and thirty-first, I am all dandy.", "Woah there, buckaroo! That's a mighty harsh language from someone communicating through a tube in the ocean over the internets.", "Now, I don't mind y'all people, but you keep botherin' me when I'm tryin'a enjoy my cold Bud in this beautiful, patriotic sunset. Haven't yall folks got better things to do then keep arguing and snicker in' around when y'all should be worried about the government and the N, S & A listenin'?", "Well, my daddy always said a man is only as good as his words and the thrust and torque of his good ole John Deere."] # Remove original message await ctx.message.delete() # Say new message await ctx.send(random.choice(beerList))
async def resurrect(self, ctx): """Menghidupkan bot yang telah mati.(Admin-server only)""" # Check for role requirements requiredRole = self.settings.getServerStat(ctx.guild, "RequiredKillRole") # isOwner = self.settings.isOwner(ctx.author) # if isOwner == False: # msgText = ["Hus hus..\nFitur ini sedang dalam tahap pengambangan"] # msg = random.choice(msgText) # return await ctx.send(msg) if requiredRole == "": #admin only if not await Utils.is_admin_reply(ctx): return else: #role requirement if not any(x for x in ctx.author.roles if str(x.id) == str( requiredRole)) and not Utils.is_admin(ctx): msg = "┐( ̄ヘ ̄;)┌\nKamu tidak memiliki izin untuk menggunakan command ini." em = discord.Embed(color=0XFF8C00, description="{}".format(msg)) return await ctx.send(embed=em) iskill = self.settings.getServerStat(ctx.guild, "Killed") if not iskill: em = discord.Embed( color=0XFF8C00, description= "┐( ̄ヘ ̄;)┌\nAku masih hidup.\nuntuk apa kamu menggunakan command ini?" ) em.set_footer(text="{}#{}".format(ctx.author.name, ctx.author.discriminator), icon_url="{}".format(ctx.author.avatar_url)) return await ctx.send(embed=em) self.settings.setServerStat(ctx.guild, "Killed", False) self.settings.setServerStat(ctx.guild, "Hunger", "0") killedby = self.settings.getServerStat(ctx.guild, "KilledBy") killedby = DisplayName.memberForID(killedby, ctx.guild) msg = 'Tebak siapa yang kembali??\nMungkin *{}* akan membunuhku lagi!*'.format( DisplayName.name(killedby)) em = discord.Embed(color=0XFF8C00, description="{}".format(msg)) em.set_footer(text="{}#{}".format(ctx.author.name, ctx.author.discriminator), icon_url="{}".format(ctx.author.avatar_url)) await ctx.send(embed=em)
async def feed(self, ctx, food: int = None): """Memberi makan bot dengan XP yang kalian miliki!""" # feed the bot, and maybe you'll get something in return! msg = '`{}feed [Jumlah XP]`'.format(ctx.prefix) em = discord.Embed( color=0XFF8C00, description="> Memberi makan bot dengan XP yang kalian miliki!" "> **Panduan**" "> {}".format(msg)) if food == None: return await channel.send(embed=em) if not type(food) == int: return await channel.send(embed=em) isAdmin = Utils.is_admin(ctx) isBotAdmin = Utils.is_bot_admin_only(ctx) botAdminAsAdmin = self.settings.getServerStat(ctx.guild, "BotAdminAsAdmin") adminUnlim = self.settings.getServerStat(ctx.guild, "AdminUnlimited") reserveXP = self.settings.getUserStat(ctx.author, ctx.guild, "XPReserve") minRole = self.settings.getServerStat(ctx.guild, "MinimumXPRole") requiredXP = self.settings.getServerStat(ctx.guild, "RequiredXPRole") isKill = self.settings.getServerStat(ctx.guild, "Killed") hunger = int(self.settings.getServerStat(ctx.guild, "Hunger")) xpblock = self.settings.getServerStat(ctx.guild, "XpBlockArray") approve = True decrement = True # Check Food if food > int(reserveXP): approve = False msg = '┐( ̄ヘ ̄;)┌\nKamu tidak dapat memberi ku makan dengan xp *{:,}*\nKamu hanya memiliki *{:,}* xp tersimpan!'.format( food, reserveXP) if food < 0: msg = '(҂⌣̀_⌣́) kamu tidak bisa memberiku makan dengan xp kurang dari 0.\nKamu pikir itu lucu?!' approve = False # Avoid admins gaining xp decrement = False if food == 0: msg = '┐( ̄ヘ ̄;)┌\nKamu tidak dapat memberi ku makan dengan xp *0*' approve = False # RequiredXPRole if not self._can_xp(ctx.author, ctx.guild): approve = False msg = '┐( ̄ヘ ̄;)┌\nKamu tidak memiliki permission untuk memberiku makan.' # Check bot admin if isBotAdmin and botAdminAsAdmin: # Approve as admin approve = True if adminUnlim: # No limit decrement = False else: if food < 0: # Don't decrement if negative decrement = False if food > int(reserveXP): # Don't approve if we don't have enough msg = '┐( ̄ヘ ̄;)┌\nKamu tidak dapat memberi ku makan dengan xp *{:,}*\nKamu hanya memiliki *{:,}* xp tersimpan!'.format( food, reserveXP) approve = False # Check admin last - so it overrides anything else if isAdmin: # No limit - approve approve = True if adminUnlim: # No limit decrement = False else: if food < 0: # Don't decrement if negative decrement = False if food > int(reserveXP): # Don't approve if we don't have enough msg = '┐( ̄ヘ ̄;)┌\nKamu tidak dapat memberi ku makan dengan *{:,} xp*\nKamu hanya memiliki *{:,}* xp tersimpan!'.format( food, reserveXP) approve = False # Check if we're blocked if ctx.author.id in xpblock: msg = "┐( ̄ヘ ̄;)┌\nKamu tidak dapat memberi makan bot!" approve = False else: if any(x for x in ctx.author.roles if x.id in xpblock): msg = "┐( ̄ヘ ̄;)┌\nRole kamu tidak dapat memberi makan bot!" approve = False if approve: # Feed was approved - let's take the XPReserve right away # Apply food - then check health hunger -= food self.settings.setServerStat(ctx.guild, "Hunger", hunger) takeReserve = -1 * food if decrement: self.settings.incrementStat(ctx.author, ctx.guild, "XPReserve", takeReserve) if isKill: # Bot's dead... msg = '*{}* Secara perlahan memberikan *{:,} xp* kepada *{}* yang telah mati...\nApakah mungkin akan bangkit suatu saat nanti?'.format( DisplayName.name(ctx.author), food, DisplayName.serverNick(self.bot.user, ctx.guild)) em = discord.Embed(color=0XFF8C00, description="{}".format(msg)) return await ctx.send(embed=em) # Bet more, less chance of winning, but more winnings! chanceToWin = 50 payout = int(food * 2) # 1/chanceToWin that user will win - and payout is double the food randnum = random.randint(1, chanceToWin) if randnum == 1: # YOU WON!! self.settings.incrementStat(ctx.author, ctx.guild, "XP", int(payout)) msg = '*{}* Secara perlahan memberikan *{:,} xp* kepada *{}* yang telah mati...\nApakah mungkin akan bangkit suatu saat nanti?*'.format( DisplayName.name(ctx.author), food, int(payout)) # Got XP - let's see if we need to promote await CheckRoles.checkroles(ctx.author, ctx.channel, self.settings, self.bot) else: msg = '*{}* Memberi ku makan dengan *{:,} xp!*\nTerima kasih banyak!!'.format( ctx.author, food) if hunger <= -150: # Kill the bot here self.settings.setServerStat(ctx.guild, "Killed", True) self.settings.setServerStat(ctx.guild, "KilledBy", ctx.author.id) msg = '{}\n\nAku dibunuh...\n\n*{}* pelakunya...'.format( msg, DisplayName.name(ctx.author.id)) elif hunger <= -100: msg = '{}\n\nApakah kamu mencoba membunuh ku?\nBerhentilah jika kamu memiliki hati!'.format( msg) elif hunger <= -75: msg = '{}\n\n(; ̄д ̄)\nAku sudah terlalu gemuk sekarangdan kesehatan ku menurun.\n Apa kamu memikirkan kesehatan ku??'.format( msg) elif hunger <= -50: msg = '{}\n\n(; ̄д ̄) Aku obesitas.\nMakanan adalah musuh ku sekarang.'.format( msg) elif hunger <= -25: msg = '{}\n\n(; ̄д ̄)\nAku gemuk.\noke waktunya diet?'.format( msg) elif hunger <= -10: msg = '{}\n\n(; ̄д ̄)\nAku gemuk.\nAku akan bertambah semakin gemuk jika kamu terus memberiku makan.'.format( msg) elif hunger <= -1: msg = '{}\n\n(;*´Д`)ノ\nAku sudah kenyang.\nAku harus berhenti makan untuk sejenak...'.format( msg) elif hunger == 0: msg = '{}\n\n(;*´Д`)ノ\nJika kamu terus memberiku makan, aku akan menjadi gemuk...'.format( msg) em = discord.Embed(color=0XFF8C00, description="{}".format(msg)) em.set_footer(text="{}#{}".format(ctx.author.name, ctx.author.discriminator), icon_url="{}".format(ctx.author.avatar_url)) await ctx.send(embed=em)
async def feed(self, ctx, food: int = None): """Feed the bot some xp!""" # feed the bot, and maybe you'll get something in return! msg = 'Usage: `{}feed [xp reserve feeding]`'.format(ctx.prefix) if food == None: return await channel.send(msg) if not type(food) == int: return await channel.send(msg) isAdmin = Utils.is_admin(ctx) isBotAdmin = Utils.is_bot_admin_only(ctx) botAdminAsAdmin = self.settings.getServerStat(ctx.guild, "BotAdminAsAdmin") adminUnlim = self.settings.getServerStat(ctx.guild, "AdminUnlimited") reserveXP = self.settings.getUserStat(ctx.author, ctx.guild, "XPReserve") minRole = self.settings.getServerStat(ctx.guild, "MinimumXPRole") requiredXP = self.settings.getServerStat(ctx.guild, "RequiredXPRole") isKill = self.settings.getServerStat(ctx.guild, "Killed") hunger = int(self.settings.getServerStat(ctx.guild, "Hunger")) xpblock = self.settings.getServerStat(ctx.guild, "XpBlockArray") approve = True decrement = True # Check Food if food > int(reserveXP): approve = False msg = 'You can\'t feed me *{:,}*, you only have *{:,}* xp reserve!'.format( food, reserveXP) if food < 0: msg = 'You can\'t feed me less than nothing! You think this is funny?!' approve = False # Avoid admins gaining xp decrement = False if food == 0: msg = 'You can\'t feed me *nothing!*' approve = False # RequiredXPRole if not self._can_xp(ctx.author, ctx.guild): approve = False msg = 'You don\'t have the permissions to feed me.' # Check bot admin if isBotAdmin and botAdminAsAdmin: # Approve as admin approve = True if adminUnlim: # No limit decrement = False else: if food < 0: # Don't decrement if negative decrement = False if food > int(reserveXP): # Don't approve if we don't have enough msg = 'You can\'t feed me *{:,}*, you only have *{:,}* xp reserve!'.format( food, reserveXP) approve = False # Check admin last - so it overrides anything else if isAdmin: # No limit - approve approve = True if adminUnlim: # No limit decrement = False else: if food < 0: # Don't decrement if negative decrement = False if food > int(reserveXP): # Don't approve if we don't have enough msg = 'You can\'t feed me *{:,}*, you only have *{:,}* xp reserve!'.format( food, reserveXP) approve = False # Check if we're blocked if ctx.author.id in xpblock: msg = "You can't feed the bot!" approve = False else: if any(x for x in ctx.author.roles if x.id in xpblock): msg = "Your role cannot feed the bot!" approve = False if approve: # Feed was approved - let's take the XPReserve right away # Apply food - then check health hunger -= food self.settings.setServerStat(ctx.guild, "Hunger", hunger) takeReserve = -1 * food if decrement: self.settings.incrementStat(ctx.author, ctx.guild, "XPReserve", takeReserve) if isKill: # Bot's dead... msg = '*{}* carelessly shoves *{:,} xp* into the carcass of *{}*... maybe resurrect them first next time?'.format( DisplayName.name(ctx.author), food, DisplayName.serverNick(self.bot.user, ctx.guild)) return await ctx.send(msg) # Bet more, less chance of winning, but more winnings! chanceToWin = 50 payout = int(food * 2) # 1/chanceToWin that user will win - and payout is double the food randnum = random.randint(1, chanceToWin) if randnum == 1: # YOU WON!! self.settings.incrementStat(ctx.author, ctx.guild, "XP", int(payout)) msg = '*{}\'s* offering of *{:,}* has made me feel *exceptionally* generous. Please accept this *magical* package with *{:,} xp!*'.format( DisplayName.name(ctx.author), food, int(payout)) # Got XP - let's see if we need to promote await CheckRoles.checkroles(ctx.author, ctx.channel, self.settings, self.bot) else: msg = '*{}* fed me *{:,} xp!* Thank you, kind soul! Perhaps I\'ll spare you...'.format( DisplayName.name(ctx.author), food) if hunger <= -150: # Kill the bot here self.settings.setServerStat(ctx.guild, "Killed", True) self.settings.setServerStat(ctx.guild, "KilledBy", ctx.author.id) msg = '{}\n\nI am kill...\n\n*{}* did it...'.format( msg, DisplayName.name(ctx.author)) elif hunger <= -100: msg = '{}\n\nYou *are* going to kill me... Stop *now* if you have a heart!'.format( msg) elif hunger <= -75: msg = '{}\n\nI\'m looking fat to an extremely unhealthy degree... maybe you should think about *my* health?'.format( msg) elif hunger <= -50: msg = '{}\n\nI\'m obese :( ... Eating is my enemy right now.'.format( msg) elif hunger <= -25: msg = '{}\n\nI\'m kinda fat... Diet time?'.format(msg) elif hunger <= -10: msg = '{}\n\nI\'m getting pudgy... I may get fat if you keep going.'.format( msg) elif hunger <= -1: msg = '{}\n\nI\'m getting stuffed... maybe I should take a break from eating...'.format( msg) elif hunger == 0: msg = '{}\n\nIf you keep feeding me, I *may* get fat...'.format( msg) await ctx.send(msg)