From 51a31caf99557857e8bf062a10f5b90626d248cb Mon Sep 17 00:00:00 2001 From: neersighted Date: Fri, 23 Mar 2012 19:36:24 -0700 Subject: [PATCH 1/7] Update plugins/urlparse.py --- plugins/urlparse.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/urlparse.py b/plugins/urlparse.py index d8a9b62..58fb8e2 100755 --- a/plugins/urlparse.py +++ b/plugins/urlparse.py @@ -4,8 +4,7 @@ import re titler = re.compile(r'(?si)(.+?)') -def parse(url): - """ an improved version of our parsing code - now regex powered """ +def gettitle(url): url = urlnorm.normalize(url.encode('utf-8')) url = url.decode('utf-8') # add http if its missing @@ -34,4 +33,4 @@ def parse(url): @hook.command def title(inp): ".title -- gets the title of a web page" - return parse(inp) + return gettitle(inp) From f5d09dc35e1348a2aa48b49da8d0d8a3b69d599c Mon Sep 17 00:00:00 2001 From: neersighted Date: Fri, 23 Mar 2012 20:13:50 -0700 Subject: [PATCH 2/7] remove derpy config settings --- core/config.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/config.py b/core/config.py index 0401d3a..d8b5986 100755 --- a/core/config.py +++ b/core/config.py @@ -46,10 +46,6 @@ if not os.path.exists('config'): "factoids": { "prefix": false - }, - "urlparse": - { - "enabled": false } }, "censored_strings": From cb33198bfb52a32f33b2d27fbc3b001cada47cc4 Mon Sep 17 00:00:00 2001 From: neersighted Date: Fri, 23 Mar 2012 20:34:33 -0700 Subject: [PATCH 3/7] fix help messages --- plugins/mute.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/mute.py b/plugins/mute.py index d59ded5..be378c9 100755 --- a/plugins/mute.py +++ b/plugins/mute.py @@ -40,11 +40,11 @@ def mutesieve(bot, input, func, type, args): @hook.command(autohelp=False) def listmuted(inp, bot=None): - ".listmuted -- Lists muted users/channels." + ".listmuted -- Lists muted channels/users." if muted: - return "Muted users/channels are: " + ", ".join(muted) + return "Muted channels/users are: " + ", ".join(muted) else: - return "No users are currently muted." + return "No channels/users are currently muted." @hook.command(adminonly=True) From ac9e567eaf69df7d8d8734537c832f6891da3c0c Mon Sep 17 00:00:00 2001 From: neersighted Date: Fri, 23 Mar 2012 20:42:08 -0700 Subject: [PATCH 4/7] renamed mute.py to ignore.py --- plugins/ignore.py | 73 +++++++++++++++++++++++++++++++++++++++++++++++ plugins/mute.py | 73 ----------------------------------------------- 2 files changed, 73 insertions(+), 73 deletions(-) create mode 100755 plugins/ignore.py delete mode 100755 plugins/mute.py diff --git a/plugins/ignore.py b/plugins/ignore.py new file mode 100755 index 0000000..fbeeba7 --- /dev/null +++ b/plugins/ignore.py @@ -0,0 +1,73 @@ +from util import hook + +ignorelist = [] + + +def ignore_target(target): + """ ignores someone """ + target = target.lower() + ignorelist.append(target) + + +def unignore_target(target): + """ unignores someone """ + target = target.lower() + ignorelist.remove(target) + + +def is_ignored(target): + """ checks of someone is ignored """ + target = target.lower() + if target in ignorelist: + return True + else: + return False + + +@hook.sieve +def ignoresieve(bot, input, func, type, args): + """ blocks input from ignored channels/users """ + # don't block input to event hooks + if type == "event": + return input + if is_ignored(input.chan) or is_ignored(input.nick): + if input.command == "PRIVMSG" and input.lastparam[1:] == "unignore": + return input + else: + return None + return input + + +@hook.command(autohelp=False) +def ignored(inp, bot=None): + ".ignored -- Lists ignored channels/users." + if ignorelist: + return "Ignored channels/users are: " + ", ".join(ignorelist) + else: + return "No channels/users are currently ignored." + + +@hook.command(adminonly=True) +def ignore(inp, input=None, notice=None): + ".ignore -- Makes the bot ignore ." + target = inp + + if is_ignored(target): + notice("%s is already ignored." % target) + else: + ignore_target(target) + notice("%s has been ignored." % target) + + +@hook.command(adminonly=True) +def unignore(inp, input=None, notice=None): + ".unignore -- Makes the bot listen to ." + target = inp + + if is_ignored(target): + unignore_target(target) + notice("%s has been unignored." % target) + return + else: + notice("%s is not ignored." % target) + return diff --git a/plugins/mute.py b/plugins/mute.py deleted file mode 100755 index be378c9..0000000 --- a/plugins/mute.py +++ /dev/null @@ -1,73 +0,0 @@ -from util import hook - -muted = [] - - -def mute_target(target): - """ mutes someone """ - target = target.lower() - muted.append(target) - - -def unmute_target(target): - """ unmutes someone """ - target = target.lower() - muted.remove(target) - - -def is_muted(target): - """ checks of someone is muted """ - target = target.lower() - if target in muted: - return True - else: - return False - - -@hook.sieve -def mutesieve(bot, input, func, type, args): - """ blocks input from muted channels/users """ - # don't block input to event hooks - if type == "event": - return input - if is_muted(input.chan) or is_muted(input.nick): - if input.command == "PRIVMSG" and input.lastparam[1:] == "unmute": - return input - else: - return None - return input - - -@hook.command(autohelp=False) -def listmuted(inp, bot=None): - ".listmuted -- Lists muted channels/users." - if muted: - return "Muted channels/users are: " + ", ".join(muted) - else: - return "No channels/users are currently muted." - - -@hook.command(adminonly=True) -def mute(inp, input=None, db=None): - ".mute -- Makes the bot ignore ." - target = inp - - if is_muted(target): - input.notice("%s is already muted." % target) - else: - mute_target(target) - input.notice("%s has been muted." % target) - - -@hook.command(adminonly=True) -def unmute(inp, input=None, db=None): - ".unmute -- Makes the bot listen to ." - target = inp - - if is_muted(target): - unmute_target(target) - input.notice("%s has been unmuted." % target) - return - else: - input.notice("%s is not muted." % target) - return From 25fd9358f21c76fb86d681a7a284746050952d80 Mon Sep 17 00:00:00 2001 From: neersighted Date: Fri, 23 Mar 2012 21:17:26 -0700 Subject: [PATCH 5/7] Update core/config.py --- core/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/config.py b/core/config.py index d8b5986..3354404 100755 --- a/core/config.py +++ b/core/config.py @@ -38,8 +38,8 @@ if not os.path.exists('config'): "bitly_api": "INSERT API KEY FROM bitly.com HERE", "wolframalpha": "INSERT API KEY FROM wolframalpha.com HERE", "lastfm": "INSERT API KEY FROM lastfm HERE", - "mc_user": "INSERT MINECRAFT USERNAME HERE", - "mc_pass": "INSERT MINECRAFT PASSWORD HERE" + "mc_user": "INSERT minecraft USERNAME HERE", + "mc_pass": "INSERT minecraft PASSWORD HERE" }, "plugins": { @@ -53,7 +53,7 @@ if not os.path.exists('config'): "mypass", "mysecret" ], - "admins": ["myname"] + "admins": ["myname@myhost"] }''') + '\n') print "Config generated!" print "Please edit the config now!" From 9ce44024c2fcda74dbea3985979fd723996a9551 Mon Sep 17 00:00:00 2001 From: neersighted Date: Sat, 24 Mar 2012 19:15:11 -0700 Subject: [PATCH 6/7] fixes --- plugins/admin.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/plugins/admin.py b/plugins/admin.py index 4b65124..38487e1 100755 --- a/plugins/admin.py +++ b/plugins/admin.py @@ -49,15 +49,15 @@ def clearlogs(inp, input=None): @hook.command(adminonly=True) -def join(inp, input=None, notice=None): - ".join -- joins ." +def join(inp, conn=None, notice=None): + ".join -- Joins ." notice("Attempting to join " + inp + "...") conn.cmd("JOIN", [inp]) @hook.command(adminonly=True) def cycle(inp, conn=None, notice=None): - ".cycle -- cycles ." + ".cycle -- Cycles ." notice("Attempting to cycle " + inp + "...") conn.cmd("PART", [inp]) conn.cmd("JOIN", [inp]) @@ -65,7 +65,7 @@ def cycle(inp, conn=None, notice=None): @hook.command(adminonly=True) def part(inp, conn=None, notice=None): - ".part -- parts ." + ".part -- Parts from ." notice("Attempting to part from " + inp + "...") conn.cmd("PART", [inp]) @@ -88,8 +88,10 @@ def raw(inp, conn=None, notice=None): @hook.command(adminonly=True) -def kick(inp, chan=None, notice=None): - ".kick [channel] [reason] -- kicks a user." +def kick(inp, input=None, chan=None, conn=None, notice=None): + ".kick [channel] [reason] -- Makes the bot kick in [channel] "\ + "If [channel] is blank the bot will kick the in "\ + "the channel the command was used in." split = inp.split(" ") if split[0][0] == "#": chan = split[0] @@ -113,11 +115,11 @@ def kick(inp, chan=None, notice=None): out = out + " :" + reason notice("Attempting to kick %s from %s..." % (user, chan)) - input.conn.send(out) + conn.send(out) @hook.command(adminonly=True) -def say(inp, input=None, notice=None): +def say(inp, conn=None, notice=None): ".say [channel] -- Makes the bot say in [channel]. "\ "If [channel] is blank the bot will say the in "\ "the channel the command was used in." @@ -134,12 +136,12 @@ def say(inp, input=None, notice=None): message = message + x + " " message = message[:-1] out = "PRIVMSG %s :%s" % (input.chan, message) - input.conn.send(out) + conn.send(out) @hook.command("me", adminonly=True) @hook.command(adminonly=True) -def act(inp, input=None, notice=None): +def act(inp, conn=None, notice=None): ".act [channel] -- Makes the bot act out in [channel] "\ "If [channel] is blank the bot will act the in "\ "the channel the command was used in." @@ -156,7 +158,7 @@ def act(inp, input=None, notice=None): message = message + x + " " message = message[:-1] out = "PRIVMSG %s :\x01ACTION %s\x01" % (input.chan, message) - input.conn.send(out) + conn.send(out) @hook.command(adminonly=True) From f26e2cd094751e00b3b5994cd5637c3246213588 Mon Sep 17 00:00:00 2001 From: lukeroge Date: Mon, 26 Mar 2012 11:25:57 +1300 Subject: [PATCH 7/7] You can now admin users by nick --- plugins/sieve.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/sieve.py b/plugins/sieve.py index 46e54b7..64411ee 100755 --- a/plugins/sieve.py +++ b/plugins/sieve.py @@ -36,11 +36,7 @@ def sieve_suite(bot, input, func, kind, args): if args.get('adminonly', False): admins = bot.config.get('admins', []) - # admins = ["u3601@irccloud.com", "brjannc@smurfed.org"] - - mask = input.user + "@" + input.host - - if mask not in admins: + if input.mask not in admins and input.nick not in admins: return None return input