def onCommandRandom(sender,args): if len(args) == 1 and args[0].isdigit(): sender.sendMessage(str(random.randint(0,int(args[0])))) return True if len(args) == 2 and args[0].isdigit() and args[1].isdigit(): if args[0] > args[1]: sender.sendMessage(str(random.randint(int(args[1]),int(args[0])))) return True sender.sendMessage(str(random.randint(int(args[0]),int(args[1])))) return True if len(args) == 3 and args[0].isdigit() and args[1].isdigit() and args[2].isdigit(): precision = 10 % int(args[2]) sender.sendMessage(str((random.randint(precision*int(args[0]),precision*int(args[1])))/precision)) return True if len(args) == 0: sender.sendMessage(str(random.randint(0,10))) return True sender.sendMessage(''.join([color("c"),"Use the syntax ",color("6"),"/random [a] [b]"])) return False
def onCommandCalc(sender,args): global colour, appended, comp if len(args)==0: sender.sendMessage('This function requires an expression to calculate!') return False c=Calc(' '.join(args),sender) if c==None: sender.sendMessage('Invalid expression!') return False elif c==ValueError: return False sta = ''.join(args) sta = sta.replace('deg(','dEgrEEs(') sta = sta.replace('ceil()','cEil(') sta = list(sta.replace('pi','PI')) comp = [] colour = '7' cs = random.choice(colourschemes) for a in sta: appended = False if a.isdigit(): coladd(cs[0]) if 'ePI'.find(a) != -1: coladd(cs[1]) if '(),.'.find(a) != -1: coladd(cs[2]) if not appended: coladd(cs[3]) comp.append(a) sender.sendMessage(''.join([color('7'),''.join(comp).lower(),color('7')," = ",color('3'),color('l'),str(c)])) return True
def onCommandFoodfight(sender,args): if len(args) == 0: sender.sendMessage(color("c") + "/slap [Player] [Thing]") return False receiver = Bukkit.getPlayer(args[0]) if receiver == None: sender.sendMessage(color("c") + 'No such player.') return False if len(args) > 1: item = ' '.join(args[1:]) number = '1' for i in args[1:]: if not i.isdigit() and i != 'some': if number != 1: if i[len(i)-1:] == 's': sudo(' '.join(('give',receiver.getName(),i[:len(i)-1],number))) if i[len(i)-2:] == 'es': Sudo(' '.join(('give',receiver.getName(),i[:len(i)-2],number))) else: Sudo(' '.join(('give ',receiver.getName(),i,number))) else: Sudo(' '.join(('give ',receiver.getName(),i,'1'))) number = 1 if i == 'some': number = str(random.randint(2,8)) if i.isdigit(): number = i Word1 = args[1] else: item = 'large trout' Sudo('give '+receiver.getName()+' fish 1') i = 'fishy' Word1 = 'large' material = None if receiver == sender: receiverName = 'themselves' else: receiverName = receiver.getName() if not (Word1 == 'some' or Word1.isdigit()): if Word1[0].lower() in vowels: amount = 'an ' else: amount = 'a ' else: amount = '' Bukkit.broadcastMessage(color("5") + sender.getName() + color("c") + " slapped " + color("5") + receiverName + color("c") + " about a bit with " + amount + color("6") + item) if random.randint(0,1): receiver.addPotionEffect(PotionEffect(PotionEffectType.CONFUSION, 160, 3, True)) else: receiver.addPotionEffect(PotionEffect(PotionEffectType.SLOW, 40, 1, True)) return True
def onCommandMe(sender, args): if len(args) < 1: return False message = ' '.join(args) broadcastMessage(''.join([color("7"), "*", color("e"), sender.getName(), color("f"), " ", message])) return True
def onCommandMushroom(sender, args): Bukkit.dispatchCommand(sender,"eff rem") sender.sendMessage(''.join([color("a"),"You find some mushrooms on the floor ... mmm",color("2")," tasty"])) sender.sendMessage(''.join([color(str(random.randint(1,3))),random.choice(mushroomsayings)])) sender.addPotionEffect(PotionEffect(eval(''.join(["PotionEffectType.",random.choice(mushroomeffects)])), 300, 3, True)) return True
def onCommandCake(sender, args): Bukkit.dispatchCommand(sender,"eff rem") sender.sendMessage(''.join([color("9"),"You take a slice of cake - it looks so",color("6")," soft and moist"])) sender.sendMessage(''.join([color(str(random.randint(4,6))),random.choice(cakesayings)])) sender.addPotionEffect(PotionEffect(eval(''.join(["PotionEffectType.",random.choice(cakeeffects)])), 300, 3, True)) return True
def onCommandHate(sender, args): hates = "Redgame" if len(args) > 0: hates = ' '.join(args) Bukkit.broadcastMessage(''.join([color("a"),sender.getName(),color("2"),color("l")," hates ",color("a"),hates])) return True
def onCommandLove(sender, args): loves = "RSW" if len(args) > 0: loves = ' '.join(args) Bukkit.broadcastMessage(''.join([color("d"),sender.getName(),color("4"),color("l")," <3 ",color("d"),loves])) return True
def onCommandFast(sender, args): Bukkit.dispatchCommand(sender,"eff rem") sender.addPotionEffect(PotionEffect(PotionEffectType.SPEED, 50000, 50, True)) sender.addPotionEffect(PotionEffect(PotionEffectType.JUMP, 50000, 9, True)) sender.addPotionEffect(PotionEffect(PotionEffectType.BLINDNESS, 30, 2, True)) sender.sendMessage(''.join([color("5"),color("l"),"SUPER",color("6")," speed! :D"])) return True
def onCommandChoose(sender, args): if len(args) == 0: sender.sendMessage(''.join([color('c'),'You must have some things to choose between'])) return False sender.sendMessage(''.join([color('5'),color('l'),'You roll your magic dice!'])) sender.sendMessage(random.choice(args)) return True
def onCommandChoose(sender, args): if not args: sender.sendMessage(color("c") + 'You must have some things to choose between') return False sender.sendMessage(color("5") + color("l") + 'You roll your magic dice!') sender.sendMessage(random.choice(args)) return True
def onCommandItemname(sender,args): if len(args) == 0: sender.sendMessage(''.join([color("c"),"You must have an argument -",color("6")," /eff [effect] [power] [duration]",color("c")," you can also use 'rem' and 'list' as effects, for special functions"])) return False if args[0] == "rem": if len(args) < 2: for effect in sender.getActivePotionEffects(): sender.removePotionEffect(effect.getType()) return True elif int(args[1]) < sender.getActivePotionEffects(): effect = sender.getActivePotionEffects()[int(args[1])] sender.removePotionEffect(effect.getType()) return True if args[0] == "list" and len(args) > 0: if len(args) < 2: Bukkit.dispatchCommand(sender,"e") else: Bukkit.dispatchCommand(sender,''.join(["e ",args[1]])) return True if len(args) < 3: sender.sendMessage(''.join([color("c"),"You must have the correct amount of arguments -",color("6")," /eff [effect] [power] [duration]"])) return False for i in range(1,2): if args[i].isdigit() == False: sender.sendMessage(''.join([color("c"),"Your power and duration must be integers -",color("6")," /eff [effect] [power] [duration]"])) return False args[0] = args[0].upper() args[0] = args[0].replace(" ","") args[0] = args[0].replace(".","") if len(args) == 4: receiver = Bukkit.getPlayer(args[3]) if receiver == None: sender.sendMessage(''.join([color("c"),"Invalid player"])) return False else: receiver = sender receiver.addPotionEffect(PotionEffect(eval(''.join(["PotionEffectType.",args[0]])), int(args[2]), (int(args[1])-1))) return True
def OnCommandCChat(sender, args): if len(args) != 2: return False cmd = args[0] chan = args[1] if cmd == "join": if Chans.Join(sender, chan): sender.sendMessage("Welcome to channel " + color("9") + chan) else: sender.sendMessage(color("c") + "You are already in that channel") return True elif cmd == "leave": if Chans.Leave(sender, chan): sender.sendMessage("You have left the channel") else: sender.sendMessage("You are not in that channel") return True elif cmd == "info": if chan not in Chans.Channels: sender.sendMessage("No such channel") return True msg = ', '.join([x.getName() for x in Chans.Channels[chan].players]) sender.sendMessage("Players in channel " + chan + ": " + msg) return True elif cmd == "switch": if chan not in Chans.Channels: sender.sendMessage("No such channel") return True if sender not in Chans.Channels[chan].players: sender.sendMessage("You are not in that channel") return True Chans.ActiveChannel[sender.getName()] = chan return True return False
def onCommandHuzza(sender, args): # TODO: Add support for custom name colors bukkit.Bukkit.broadcastMessage("".join([sender.getName(), color("f"), " Yells: HUZZA!"])) bukkit.Bukkit.dispatchCommand(sender, "suicide") return True
def onCommandJoin(sender, args): bukkit.Bukkit.broadcastMessage("".join([color("e"), args[0], " joined the game"])) if len(args) > 1: bukkit.Bukkit.broadcastMessage("".join(["Player ", args[0], " comes from ", args[1]])) return True
def onCommandLeave(sender, args): if len(args) < 1: return False bukkit.Bukkit.broadcastMessage(''.join([color("e"), args[0], " left the game"])) return True
def coladd(c): global colour, comp, appended appended = True if colour != c: colour = c comp.append(color("c"))#?
def onCommandFoodfight(sender,args): if len(args) == 0: sender.sendMessage(''.join([color("c"),"You must specify who you are to throw food at."])) return False food = random.randint(1,(len(foodlistitem)-1)) receiver = Bukkit.getPlayer(args[0]) if receiver == None: sender.sendMessage(''.join([color('c'),'No such player.'])) return False sudo(''.join(["give ",args[0],foodlistitem[food]," 1"])) if food == 1: Bukkit.broadcastMessage(''.join([color("5"),sender.getName(),color("c")," threw an ",color("6"),"apple",color("c")," at ",color("5"),receiver.getName()])) else: Bukkit.broadcastMessage(''.join([color("5"),sender.getName(),color("c")," threw a ",color("6"),foodlistname[food],color("c")," at ",color("5"),receiver.getName()])) if random.randint(1,5) == 1: receiver.addPotionEffect(PotionEffect(PotionEffectType.BLINDNESS, 40, 1, True)) Bukkit.broadcastMessage(''.join([color("5"),"Headshot!"])) return True
def onCommandJoin(sender, args): if len(args) < 1: return False broadcastMessage(''.join([color("e"), args[0], " joined the game"])) if len(args) > 1: broadcastMessage(''.join(["Player ", args[0], " comes from ", args[1]])) return True
def onCommandLore(sender, args): if len(args) == 0: sender.sendMessage(''.join([color('c'),'You must have a name!'])) return False argstring = ''.join(args).replace('#f',u'\u00A7') I = sender.getItemInHand() Imeta = I.getItemMeta() Imeta.setDisplayName(argstring) I.setItemMeta(Imeta) return True
def onCommandsPloc(sender, args): l = getlocdual(sender) if l: infreturn(''.join([color('e'),str(l)]),sender) if plots[l][0] == False: infreturn('Unclaimed',sender) else: infreturn(''.join(['Claimed by ',plots[l][0]]),sender) return True redreturn('No such plot',sender) return False
def onCommandLore(sender, args): if len(args) == 0: sender.sendMessage(''.join([color('c'),'/lore [lore to add] or /lore [existing line] [edited lore]'])) return False argstring = ''.join(args).replace('#f',u'\u00A7') I = sender.getItemInHand() Imeta = I.getItemMeta() Ilore = [] if hasattr(Imeta.getLore, '__iter__'): for i in Imeta.getLore(): Ilore.append(i) if not args[0].isdigit(): Ilore.append(''.join([color('r'),' '.join(args)])) else: if int(args[0]) < 1 or len(Ilore) < int(args[0]): sender.sendMessage('You must chose a real line to edit'.join([color('c'),''])) return False Ilore[int(args[0])-1] = ' '.join(args[1:]) Imeta.setLore(Ilore) I.setItemMeta(Imeta) return True
def onCommandQuick(sender, args): Bukkit.dispatchCommand(sender,"eff rem") sender.addPotionEffect(PotionEffect(PotionEffectType.SPEED, 50000, 3, True)) sender.addPotionEffect(PotionEffect(PotionEffectType.JUMP, 50000, 2, True)) sender.addPotionEffect(PotionEffect(PotionEffectType.NIGHT_VISION, 50000, 2, True)) sender.addPotionEffect(PotionEffect(PotionEffectType.INCREASE_DAMAGE, 50000, 2, True)) sender.sendMessage(''.join([color("9"),"Super powers!"])) return True
def onCommandFoodfight(sender,args): if len(args) == 0: sender.sendMessage(color("c") + "You must specify who you are to throw food at.") return False Item = random.choice(Food.items()) receiver = Bukkit.getPlayer(args[0]) if receiver == None: sender.sendMessage(color("c") + 'No such player.') return False Sudo("give " + args[0] + ' ' + Item[1] + " 1") Singular = ('a ', 'an ')[Item[0][0] in vowels] Name = sender.getName() RName = receiver.getName() Bukkit.broadcastMessage(color("5") + Name + color("e") + " threw "+ Singular + color("6") + Item[0] + color("c") + " at " + color("5") + RName) if random.randint(1,5) == 1: receiver.addPotionEffect(PotionEffect(PotionEffectType.BLINDNESS, 40, 1, True)) Bukkit.broadcastMessage(color("5") + "Headshot!") return True
def OnCommandDerp(sender, args): if len(args) > 0 and args[0].isdigit(): index = int(args[0]) if index >= len(Derps) or index < 0: sender.sendMessage("Index out of range") return True BroadcastDerp(sender, Derps[index]) return True if len(args) > 0 and not args[0].isdigit() and sender.hasPermission('ore.derp.reload'): if args[0] == "reload": LoadDerps("Data/Derps.txt") sender.sendMessage(color("e") + "Derps reloaded") return True BroadcastDerp(sender, random.choice(Derps)) return True
def onCommandHug(sender, args): if len(args) == 0: sender.sendMessage(''.join([color("c"),"You must have an argument -",color("6")," /hug [thing]"])) return False if Bukkit.getPlayer(args[0]) != None: receiverPlayer = Bukkit.getPlayer(args[0]) receiverPlayer.sendMessage(''.join([color("d"),"You were hugged by ",sender.getName()])) receiver = receiverPlayer.getName() sender.sendMessage(''.join([color("d"),"You hugged ",receiver])) else: receiver = args[0] Bukkit.broadcastMessage(''.join([color(str(hex(random.randint(1,15)))[2]),color(str(hex(random.randint(1,15)))[2]),sender.getName(),color(str(hex(random.randint(1,15)))[2])," hugged ",color(str(hex(random.randint(1,15)))[2]),receiver])) return True
def onCommandFoodfight(sender,args): if len(args) == 0: sender.sendMessage(''.join([color("c"),"/slap [Player] [Thing]"])) return False receiver = Bukkit.getPlayer(args[0]) if len(args) == 2: item = args[1] else: item = 'large trout' material = Material.matchMaterial(args[1]) if receiver == None: sender.sendMessage(''.join([color('c'),'No such player.'])) return False if receiver == sender: receiverName = 'themself' else: reveiverName = receiver.getName() if item[0] in vowels: Bukkit.broadcastMessage(''.join([color("5"),sender.getName(),color("c")," slapped ",color("5"),receiverName,color("c")," about a bit with an ",color("5"),item])) else: Bukkit.broadcastMessage(''.join([color("5"),sender.getName(),color("c")," slapped ",color("5"),receiverName,color("c")," about a bit with a ",color("5"),item])) if random.randint(0,1): receiver.addPotionEffect(PotionEffect(PotionEffectType.CONFUSION, 160, 3, True)) else: receiver.addPotionEffect(PotionEffect(PotionEffectType.BLINDNESS, 20, 3, True)) if material != None: sudo(' '.join(['give',receiver.getName(),material.getId()])) return True
global textColor # 文字颜色覆盖 global backgroundColor # 背景色 global backgroundDiffMax # 最大色差 global colorDistance # 差值算法 global backgroundThres # 区块里有 N% 时认为是背景色块 global outColorSpace font = cfg_read_font(None, 14) spaceTextH, spaceTextV = (0, 0) paddingLR, paddingUB = (0, 0) texts = repeat('#', float('Infinity')) textColor = None backgroundColor = color('#FFFFFF') backgroundDiffMax = 10 backgroundThres = percentage(50) outColorSpace = 'RGBA' RGBA_0 = (0x00, 0x00, 0x00, 0x00) def montage(img: Image, dstsize: (int, int)) -> Image: inW, inH = coordinate(img) dest = Image.new(outColorSpace, dstsize, RGBA_0) for txt in texts: textW, textH = font.getsize(txt) unitW, unitH = iplus(textW, spaceTextH), iplus(textH, spaceTextV) cols, rows = (idiv(inW, unitW), idiv(inH, unitH)) gapLR, gapUB = (inW - (cols * unitW)), (inH - (rows * unitH))
def complie(sender,args): global FullString FullString = [] if len(args) < 2: sender.sendMessage(''.join([color('c'),'You must have at least four arguments']))#Argument checking return False if (args[1])[0] != '/': sender.sendMessage(''.join([color('c'),'Your third argument must be a / or //'])) return False CommandName = args.pop(0) for i in args: if compose(i) == False: #Split command into lines sender.sendMessage(''.join([color('c'),'You cannot bind a command to an MB'])) CommandName = CommandName.replace('"',"") #Replace invalid characters in the name b = open('build/Binds.py') if ''.join(['#',CommandName,'\n']) in b.readlines(): sender.sendMessage(''.join([color('c'),'That name is already in use'])) #Checks if command name is free b.close() return False b.close() a = [] b = open('build/Binds.py','a') b.write(''.join(['#',CommandName,'\n'])) b.write(''.join(['@hook.command("',CommandName,'",description="',CommandName,', by ',sender.getName(),'")\n'])) b.write(''.join(['def onCommand',CommandName,'(sender,args):\n'])) #Write 'introduction' b.close() argsNum = 0 for i in FullString: form = 0 if i.find("#s") != -1: form = 1 i = i.replace("#s","") #Define form of line via flags if i.find("#b") != -1: form = 2 i = i.replace("#b","") if i.find("#c") != -1: form = 3 i = i.replace("#c","") i = i.replace("#t","{tab}") i = i.replace("#p",'sender.getName()') #Replace returning flags for custom code lines if i.find("#n") != -1: i = i.replace("#n",'(bukkit.Bukkit.getPlayer(args[0])).getName()') if argsNum == 0: argsNum = 1 else: i = i.replace('"',"") #Replace returning flags for normal lines, and get rid of invalid chars i = i.replace("{","") i = i.replace("}","") i = i.replace("#p",'",sender.getName(),"') if i.find("#n") != -1: i = i.replace("#n",'",(bukkit.Bukkit.getPlayer(args[0])).getName(),"') if argsNum == 0: argsNum = 1 i = i.replace("#","# ") i = i.replace("# f","#f ") l = i.split() while True: if not '#f' in l: break if form == 3: l.insert(l.index("#f"),''.join(['color("',l[(l.index("#f")+1)][0],'")'])) #Replaces color flags l[(l.index("#f")+1)] = l[(l.index("#f")+1)][1:] else: l.insert(l.index("#f"),''.join(['",color("',l[(l.index("#f")+1)][0],'"),"'])) l[(l.index("#f")+1)] = l[(l.index("#f")+1)][1:] l.remove("#f") while True: if not '#' in l: break else: argsValue = int(l[(l.index("#")+1)])+1 if argsValue.isdigit(): if argsNum < argsValue: argsNum = argsValue if form == 3: l.insert(l.index("#f"),''.join(['args["',l[(l.index("#f")+1)][0],']'])) #Replaces argument flags l[(l.index("#f")+1)] = l[(l.index("#f")+1)][1:] else: l.insert(l.index("#"),''.join(['",args[',l[(l.index("#")+1)][0],'],"'])) l[(l.index("#")+1)] = l[(l.index("#")+1)][1:] l.remove("#") else: sender.sendMessage(''.join([color('c'),'Invalid flags'])) delete(CommandName) i = ' '.join(l) if form == 1: a.append(''.join([t(),'sudo("".join(["',i,'"]))\n'])) elif form == 2: a.append(''.join([t(),'bukkit.Bukkit.broadcastMessage("".join(["',i,'"]))\n']))#Appends full argument syntax elif form == 0: a.append(''.join([t(),'bukkit.Bukkit.dispatchCommand(sender, "".join(["',i,'"]))\n'])) elif form == 3: a.append(''.join([i.replace('{tab}',t()),'\n'])) a.append(''.join([t(),'return True\n'])) a.append('\n') b = open('build/Binds.py','a') if argsNum != 0: b.write(''.join([t(),'if len(args) != ',str(argsNum),':\n'])) b.write(''.join([t(),t(),'sender.sendMessage("You must have ',str(argsNum),' arguments")\n']))#Writes if statement for amount of arguments b.write(''.join([t(),t(),'return False\n'])) for i in a: b.write(i) #Writes appends to command b.close() return True
def helpMessage(sender): sender.sendMessage(''.join([color('6'),'Arguments:'])) sender.sendMessage(''.join([color('a'),'List - lists all finished commands'])) sender.sendMessage(''.join([color('a'),'Find [Search] - Searches for a command'])) sender.sendMessage(''.join([color('a'),''])) sender.sendMessage(''.join([color('a'),'ResetAll - Resets all commands (Leave it alone)'])) sender.sendMessage(''.join([color('a'),'Write [Name] [Command] - Write a new command - This command will allow you to write more to any pending command'])) sender.sendMessage(''.join([color('a'),'Done - Comfirm that the current "/mb write" command is done, and can be turned into code'])) sender.sendMessage(''.join([color('a'),'New [Name] [Command] - Writes and creates a command in one command'])) sender.sendMessage(''.join([color('a'),'View [Command Name] - View the code for a command'])) sender.sendMessage(''.join([color('a'),'Cancel - Cancels the writing of the current "/mb write" command'])) sender.sendMessage(''.join([color('6'),'The following are flags, to be used when creating a command'])) sender.sendMessage(''.join([color('a'),'/ - Start of a new line'])) sender.sendMessage(''.join([color('a'),'#s - Excecutes the current line as a comsole command'])) sender.sendMessage(''.join([color('a'),'#c - Writes the current line as a custom line of code'])) sender.sendMessage(''.join([color('a'),'#b - Broadcasts the current line to the server'])) sender.sendMessage(''.join([color('6'),'The default setting is to exceute the line as a command by the sender'])) sender.sendMessage(''.join([color('a'),'#t - (only used woth #c) creates a tab'])) sender.sendMessage(''.join([color('a'),'#p - Name of the excecuter of the command'])) sender.sendMessage(''.join([color('a'),'#n - AutoCompleted name in the first argument'])) sender.sendMessage(''.join([color('a'),'#f[hex value] - A colour or format'])) sender.sendMessage(''.join([color('a'),'#[number] - An argument of the player'])) return True
def onCommandMb(sender,args): ops = open('build/ops.txt') if not ''.join([sender.getName(),'\n']) in ops.readlines(): ops.close() sender.sendMessage(''.join([color('c'),'You are not an op.'])) return False ops.close() if len(args) == 0: helpMessage(sender) return True if args[0] == 'list': #List b = open('build/Binds.py',"r") n = 0 nLocal = 0 s = '' sender.sendMessage(''.join([color('9'),'List of commands:'])) soStuff = True for i in b.readlines(): if i[0] == '#': s = i[1:len(i)-1] n = n + 1 nLocal = 0 doStuff = True if i[0].replace('\n','') == '' and doStuff: if nLocal / 5 > 4: sender.sendMessage(''.join([color('4'),s,color('f'),' (',str(nLocal),')'])) else: sender.sendMessage(''.join([color('ae6c4'[(nLocal/5)]),s,color('f'),' (',str(nLocal),')'])) doStuff = False else: nLocal = nLocal + 1 sender.sendMessage(''.join([color('9'),'A total of ',str(n),' commands'])) return True if args[0] == 'deleteall': #Reset sender.sendMessage(''.join([color('4'),'Are you CERTAIN you want to delete ALL MB commands?'])) sender.sendMessage(''.join([color('4'),'Respond with /mb confirmdelete or /mb declinedelete'])) if not sender.getName() in ResetAllPending == 0: ResetAllPending.append(sender.getName()) return True return False if args[0] == 'confirmdelete': if sender.getName() in ResetAllPending: b = open('build/Binds.py','w') c = open('build/Template.txt') b.writelines(c.readlines()) c.close() b.close() sender.sendMesage(''.join([color('a'),'Deleted'])) return True sender.sendMesage(''.join([color('c'),'You have no pending deletion requests'])) return False if args[0] == 'declinedelete': if sender.getName() in ResetAllPending : ResetAllPending.remove(sender.getName()) sender.sendMesage(''.join([color('a'),'Not deleted'])) return True sender.sendMesage(''.join([color('c'),'You have no pending deletion requests'])) return False ### Commands before here must need no args if len(args) < 2: helpMessage(sender) return True ### Commands after here must need args if args[0] == 'write': #Start new multi thing command args.pop(0) if not sender.getName() in WritingNames: WritingNames.append(sender.getName()) WritingLines.append(args) sender.sendMesage(''.join([color('a'),'New command started, and written to'])) return True WritingLines[WritingNames.index(sender.getName())].append(args) sender.sendMesage(''.join([color('a'),'Command written to'])) return True if args[0] == 'done': if sender.getName() in WritingNames: Written = WritingLines.pop(WritingNames.index(sender.getName())) if complie(sender, Written = WritingLines.pop(WritingNames.index(sender.getName()))): WritingNames.remove(sender.getName()) sender.sendMesage(''.join([color('a'),'Successfully written into a command'])) return True WritingNames.remove(sender.getName()) return False sender.sendMessage(''.join([color('c'),'You do not have anything being written'])) return False if args[0] == 'new': #New single thing command args.pop(0) if complie(sender,args): sender.sendMessage(''.join([color('a'),'Successfully written into a command'])) return True return False if args[0] == 'cancel': if sender.getName() in WritingNames: WritingLines.pop(WritingNames.index(sender.getName())) WritingNames.remove(sender.getName()) sender.sendMessage(''.join([color('a'),'Successfully cancelled'])) return True sender.sendMessage(''.join([color('c'),'Nothing to cancel'])) return False if args[0] == 'delete': #delete if delete(args[1]): return True b.close() sender.sendMessage(''.join([color('c'),'No such command'])) return False if args[0] == 'view': #view b = open('build/Binds.py') l = b.readlines() n = 0 if ''.join(['#',args[1],'\n']) in l: seek = l.index(''.join(['#',args[1],'\n'])) while True: if l[seek].replace('\n','') == '': b.close break n = n + 1 sender.sendMessage(''.join([str(n),': ',l.pop(seek).replace(t(),' ')])) return True sender.sendMessage(''.join([color('c'),'No such command'])) b.close() return False if args[0] == 'find': sender.sendMessage(''.join([color('9'),'Searching for "',args[1],'"'])) n = 0 n2 = 0 b = open('build/Binds.py') for i in b.readlines(): if i[0] == '#': if i.lower() == ''.join(['#',args[1].lower(),'\n']): sender.sendMessage(''.join([color('2'),i[1:len(i)-1]])) n2 = n2 + 1 elif i.lower().find(args[1].lower()) != -1: sender.sendMessage(''.join([color('a'),i[1:len(i)-1]])) n = n + 1 b.close() sender.sendMessage(''.join([color('9'),'Found ',str(n),' partial matche(s), and ',str(n2),' full matche(s)'])) return True helpMessage(sender) return True