From 397842f5180af6dff01d603568b936fd33f1712c Mon Sep 17 00:00:00 2001 From: Fletcher Boyd Date: Wed, 4 Sep 2013 20:13:03 +0800 Subject: [PATCH 1/6] More formatting. --- plugins/valvesounds.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) From d6bdf3ab38f3361173787db44d998ed46c341e33 Mon Sep 17 00:00:00 2001 From: Fletcher Boyd Date: Wed, 4 Sep 2013 20:13:45 +0800 Subject: [PATCH 2/6] Possible fix for non alphanumeric characters, needs testing. --- plugins/cypher.py | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) 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 From 706ddbfbe976704fcd1d35fdb4f4a7856099185f Mon Sep 17 00:00:00 2001 From: Fletcher Boyd Date: Wed, 4 Sep 2013 21:31:07 +0800 Subject: [PATCH 3/6] Shortened mcstatus output. --- plugins/minecraft_status.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/minecraft_status.py b/plugins/minecraft_status.py index 1a07b9f..0d7c8cf 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,18 @@ def mcstatus(inp, say=None): out = [] # use a loop so we don't have to update it if they add more servers + yes = [] + no = [] 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 += "\x034\x02Offline\x02\x0f: " + ", ".join(no) + return "\x0f" + out.replace(".mojang.com", ".mj").replace(".minecraft.net", ".mc") @hook.command("haspaid") From f54f0edff849336f3f5743428da15c127ecec56d Mon Sep 17 00:00:00 2001 From: Fletcher Boyd Date: Wed, 4 Sep 2013 21:31:36 +0800 Subject: [PATCH 4/6] Comment was commenting the wrong code. --- core/irc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 33c6ee6f19fce3e6ebb17d330b07300ca165b77c Mon Sep 17 00:00:00 2001 From: Fletcher Boyd Date: Wed, 4 Sep 2013 21:36:35 +0800 Subject: [PATCH 5/6] spaaace --- plugins/minecraft_status.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/minecraft_status.py b/plugins/minecraft_status.py index 0d7c8cf..7e1ac72 100755 --- a/plugins/minecraft_status.py +++ b/plugins/minecraft_status.py @@ -17,7 +17,7 @@ def mcstatus(inp): out = [] # use a loop so we don't have to update it if they add more servers yes = [] - no = [] + no = ['luke'] for server, status in data.items(): if status == "green": yes.append(server) @@ -25,6 +25,8 @@ def mcstatus(inp): 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") From df9fe0e8ac468b88fb4cb7f5fe8721c51c165899 Mon Sep 17 00:00:00 2001 From: Fletcher Boyd Date: Wed, 4 Sep 2013 21:55:06 +0800 Subject: [PATCH 6/6] Geocities data doesn't need to be committed. --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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