diff --git a/.gitignore b/.gitignore index 57ee2d4..20e8101 100755 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ gitflow *.sublime-project *.sublime-workspace .idea/ +plugins/data/GeoLiteCity.dat diff --git a/core/irc.py b/core/irc.py index 2248c48..006c020 100755 --- a/core/irc.py +++ b/core/irc.py @@ -178,7 +178,7 @@ class IRC(object): if paramlist[-1].startswith(':'): paramlist[-1] = paramlist[-1][1:] lastparam = paramlist[-1] - # put the parsed message in the response queue + # put the parsed message in the response queue self.out.put([msg, prefix, command, params, nick, user, host, mask, paramlist, lastparam]) # if the server pings us, pong them back diff --git a/plugins/cypher.py b/plugins/cypher.py index 7ef72ce..1c4d7d6 100755 --- a/plugins/cypher.py +++ b/plugins/cypher.py @@ -2,11 +2,10 @@ Plugin which (de)cyphers a string Doesn't cypher non-alphanumeric strings yet. by instanceoftom +All character cyphering added - TheNoodle """ from util import hook -chars = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ " -len_chars = len(chars) @hook.command @@ -20,19 +19,15 @@ def cypher(inp): out = "" passwd_index = 0 for character in inp: - try: - chr_index = chars.index(character) - passwd_chr_index = chars.index(passwd[passwd_index]) + chr_index = ord(character) + passwd_chr_index = ord(passwd[passwd_index]) - out_chr_index = (chr_index + passwd_chr_index) % len_chars - out_chr = chars[out_chr_index] + out_chr_index = (chr_index + passwd_chr_index) % 255 + out_chr = chr[out_chr_index] - out += out_chr + out += out_chr - passwd_index = (passwd_index + 1) % len_passwd - except ValueError: - out += character - continue + passwd_index = (passwd_index + 1) % len_passwd return out @@ -46,11 +41,7 @@ def decypher(inp): passwd_index = 0 for character in inp: - try: - chr_index = chars.index(character) - passwd_index = (passwd_index + 1) % len_passwd - except ValueError: - continue + passwd_index = (passwd_index + 1) % len_passwd passwd_index -= 1 reversed_message = inp[::-1] @@ -58,10 +49,10 @@ def decypher(inp): out = "" for character in reversed_message: try: - chr_index = chars.index(character) - passwd_chr_index = chars.index(passwd[passwd_index]) + chr_index = ord(character) + passwd_chr_index = ord(passwd[passwd_index]) - out_chr_index = (chr_index - passwd_chr_index) % len_chars + out_chr_index = (chr_index - passwd_chr_index) % 255 out_chr = chars[out_chr_index] out += out_chr diff --git a/plugins/minecraft_status.py b/plugins/minecraft_status.py index 1a07b9f..7e1ac72 100755 --- a/plugins/minecraft_status.py +++ b/plugins/minecraft_status.py @@ -3,7 +3,7 @@ import json @hook.command(autohelp=False) -def mcstatus(inp, say=None): +def mcstatus(inp): """mcstatus -- Checks the status of various Mojang (the creators of Minecraft) servers.""" try: @@ -16,13 +16,20 @@ def mcstatus(inp, say=None): out = [] # use a loop so we don't have to update it if they add more servers + yes = [] + no = ['luke'] for server, status in data.items(): if status == "green": - out.append("{} is \x033\x02online\x02\x0f".format(server)) + yes.append(server) else: - out.append("{} is \x034\x02offline\x02\x0f".format(server)) - - return "\x0f" + ", ".join(out) + "." + no.append(server) + if yes: + out = "\x033\x02Online\x02\x0f: " + ", ".join(yes) + if no: + out += " " + if no: + out += "\x034\x02Offline\x02\x0f: " + ", ".join(no) + return "\x0f" + out.replace(".mojang.com", ".mj").replace(".minecraft.net", ".mc") @hook.command("haspaid") diff --git a/plugins/valvesounds.py b/plugins/valvesounds.py index 71daa91..2b88312 100644 --- a/plugins/valvesounds.py +++ b/plugins/valvesounds.py @@ -52,7 +52,8 @@ def getSoundInfo(url, inp, jsondata=False): def portal2(inp): """portal2 [who - ] - Look up Portal 2 quote. Example: .portal2 cave johnson - demand to see life's manager, - .portal2 i own the place | If - is not included, no 'who' data will be sent.""" + .portal2 i own the place + If - is not included, no 'who' data will be sent.""" return getSoundInfo(portal2url, inp)