Remove all that code that was deprecated by the previous commit

master
sfan5 2014-06-22 12:32:15 +02:00
parent 499177069c
commit 4fb9723396
19 changed files with 134 additions and 277 deletions

View File

@ -34,10 +34,6 @@ for lib in libs:
setattr(env[lib], funcn, getattr(globals()[lib], funcn)) setattr(env[lib], funcn, getattr(globals()[lib], funcn))
def c(phenny, input): def c(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("Nothing to calculate.") return phenny.reply("Nothing to calculate.")
q = input.group(2).encode('ascii', 'ignore') q = input.group(2).encode('ascii', 'ignore')

View File

@ -132,10 +132,6 @@ def devwikipedia(term, language='en', last=False):
return sentence + ' - ' + (devwikiuri % (term)) return sentence + ' - ' + (devwikiuri % (term))
def devwik(phenny, input): def devwik(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
origterm = input.groups()[1] origterm = input.groups()[1]
if not origterm: if not origterm:
return phenny.say('Perhaps you meant "!devwik Zen"?') return phenny.say('Perhaps you meant "!devwik Zen"?')

View File

@ -63,10 +63,6 @@ def formatirc_user_a(arr):
return formartirc_user(arr[0],arr[1],arr[2],arr[3],arr[4],with_userid=True) return formartirc_user(arr[0],arr[1],arr[2],arr[3],arr[4],with_userid=True)
def search_forumuser(phenny, input): def search_forumuser(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
arg = input.group(2) arg = input.group(2)
if not arg: if not arg:
return phenny.reply("Give me a username") return phenny.reply("Give me a username")

View File

@ -1,9 +1,5 @@
def help(phenny, input): def help(phenny, input):
"""Help command""" """Help command"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
phenny.say("https://github.com/sfan5/minetestbot-modules/blob/master/COMMANDS.md") phenny.say("https://github.com/sfan5/minetestbot-modules/blob/master/COMMANDS.md")
help.commands = ['help'] help.commands = ['help']

12
ping.py
View File

@ -8,29 +8,17 @@ About: http://inamidst.com/phenny/
import random import random
def hello(phenny, input): def hello(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
greeting = random.choice(('Hi', 'Hey', 'Hello', 'sup')) greeting = random.choice(('Hi', 'Hey', 'Hello', 'sup'))
punctuation = random.choice(('', '!', '.')) punctuation = random.choice(('', '!', '.'))
phenny.say(greeting + ' ' + input.nick + punctuation) phenny.say(greeting + ' ' + input.nick + punctuation)
hello.rule = r'(?i)(hi|hello|hey) $nickname[ \t]*$' hello.rule = r'(?i)(hi|hello|hey) $nickname[ \t]*$'
def interjection(phenny, input): def interjection(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
phenny.say(input.nick + '!') phenny.say(input.nick + '!')
interjection.rule = r'$nickname!' interjection.rule = r'$nickname!'
interjection.priority = 'high' interjection.priority = 'high'
def l3(phenny, input): def l3(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
phenny.say('<3 ' + input.nick) phenny.say('<3 ' + input.nick)
l3.rule = r'<3 $nickname' l3.rule = r'<3 $nickname'
l3.priority = 'low' l3.priority = 'low'

View File

@ -6,7 +6,7 @@ Copyright 2013, sfan5
import random import random
rainbowcolors = ["4", "7", "8", "3", "12", "6", "13"] rainbowcolors = ["4", "7", "8", "3", "12", "6", "13"]
#TODO: make this rainbow better (can't really make it that better because IRC colors suck) #maybe TODO: make this rainbow better (can't really make it that better because IRC colors suck)
def colorize(text): def colorize(text):
out = "" out = ""
@ -25,10 +25,6 @@ def colorize(text):
return out return out
def rainbow(phenny, input): def rainbow(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
arg = input.group(2) arg = input.group(2)
if not arg: if not arg:
return phenny.say(colorize("Rainbow") + "\x03 What?") return phenny.say(colorize("Rainbow") + "\x03 What?")

View File

@ -46,6 +46,7 @@ def f_reload(phenny, input):
phenny.bind_commands() phenny.bind_commands()
phenny.reply('%r (version: %s)' % (module, modified)) phenny.reply('%r (version: %s)' % (module, modified))
f_reload.name = 'reload' f_reload.name = 'reload'
f_reload.rule = ('$nick', ['reload'], r'(\S+)?') f_reload.rule = ('$nick', ['reload'], r'(\S+)?')
f_reload.priority = 'low' f_reload.priority = 'low'

View File

@ -122,10 +122,9 @@ def rsscheck(phenny, input):
rssnotify["dont_print_first_message"] = False rssnotify["dont_print_first_message"] = False
print("[RssNotify]: Checked " + str(len(feeds)) + " RSS Feeds in %0.3f seconds" % (end-start)) print("[RssNotify]: Checked " + str(len(feeds)) + " RSS Feeds in %0.3f seconds" % (end-start))
rsscheck.priority = 'high' rsscheck.priority = 'medium'
rsscheck.rule = r'.*' rsscheck.rule = r'.*'
rsscheck.event = '*' rsscheck.event = '*'
rsscheck.thread = True
if __name__ == '__main__': if __name__ == '__main__':
print __doc__.strip() print __doc__.strip()

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
rutils.py - Phenny Utility Module rutils.py - Phenny Utility Module
Copyright 2012, Sfan5 Copyright 2012, sfan5
""" """
import base64, binascii, re, random, time, multiprocessing, hashlib import base64, binascii, re, random, time, multiprocessing, hashlib
@ -10,10 +10,6 @@ def rs(s):
def rev(phenny, input): def rev(phenny, input):
"""reverse string""" """reverse string"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("Nothing to reverse.") return phenny.reply("Nothing to reverse.")
q = input.group(2).encode('utf-8') q = input.group(2).encode('utf-8')
@ -28,10 +24,6 @@ rev.priority = 'low'
def b64e(phenny, input): def b64e(phenny, input):
"""base64 encode""" """base64 encode"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("Nothing to encode.") return phenny.reply("Nothing to encode.")
q = input.group(2).encode('utf-8') q = input.group(2).encode('utf-8')
@ -45,10 +37,6 @@ b64e.priority = 'low'
def b64d(phenny, input): def b64d(phenny, input):
"""base64 decode""" """base64 decode"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("Nothing to decode.") return phenny.reply("Nothing to decode.")
q = input.group(2).encode('utf-8') q = input.group(2).encode('utf-8')
@ -62,10 +50,6 @@ b64d.priority = 'low'
def b32e(phenny, input): def b32e(phenny, input):
"""base32 encode""" """base32 encode"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("Nothing to encode.") return phenny.reply("Nothing to encode.")
q = input.group(2).encode('utf-8') q = input.group(2).encode('utf-8')
@ -79,10 +63,6 @@ b32e.priority = 'low'
def b32d(phenny, input): def b32d(phenny, input):
"""base32 decode""" """base32 decode"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("Nothing to decode.") return phenny.reply("Nothing to decode.")
q = input.group(2).encode('utf-8') q = input.group(2).encode('utf-8')
@ -96,10 +76,6 @@ b32d.priority = 'low'
def b16e(phenny, input): def b16e(phenny, input):
"""base16 encode""" """base16 encode"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("Nothing to encode.") return phenny.reply("Nothing to encode.")
q = input.group(2).encode('utf-8') q = input.group(2).encode('utf-8')
@ -126,10 +102,6 @@ b16d.priority = 'low'
def crc32(phenny, input): def crc32(phenny, input):
"""crc32 hash""" """crc32 hash"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("Nothing to hash.") return phenny.reply("Nothing to hash.")
q = input.group(2).encode('utf-8') q = input.group(2).encode('utf-8')
@ -140,10 +112,6 @@ crc32.commands = ['crc32']
crc32.priority = 'low' crc32.priority = 'low'
def hash_(phenny, input): def hash_(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("Usage: hash <hash function> <text> | Get available hash funcs with ?") return phenny.reply("Usage: hash <hash function> <text> | Get available hash funcs with ?")
hashfuncs = { hashfuncs = {
@ -167,10 +135,6 @@ hash_.priority = 'low'
def regex(phenny, input): def regex(phenny, input):
"""regex""" """regex"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("Give me a regex and a message seperated by `") return phenny.reply("Give me a regex and a message seperated by `")
q = input.group(2).encode('utf-8') q = input.group(2).encode('utf-8')
@ -204,10 +168,6 @@ regex.thread = True
def rand(phenny, input): def rand(phenny, input):
"""Returns a random number""" """Returns a random number"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return return
arg = input.group(2) arg = input.group(2)

View File

@ -2,7 +2,7 @@
""" """
search.py - Phenny Web Search Module search.py - Phenny Web Search Module
Copyright 2008-9, Sean B. Palmer, inamidst.com Copyright 2008-9, Sean B. Palmer, inamidst.com
Modified by Sfan5 2012 Modified by sfan5 2012
Licensed under the Eiffel Forum License 2. Licensed under the Eiffel Forum License 2.
http://inamidst.com/phenny/ http://inamidst.com/phenny/
@ -10,7 +10,7 @@ http://inamidst.com/phenny/
import web, re import web, re
search_badwords = ["porn","p0rn","pr0n","pron","redtube","sex","pussy","hot","weed","smoking","drug","penis","vagina"] #Thank KikaRz, LandMine and RagnarLaud for this search_badwords = ["porn","p0rn","pr0n","pron","redtube","sex","pussy","weed","smoking","drug","penis","vagina"] # Thank KikaRz, LandMine and RagnarLaud for this
class Grab(web.urllib.URLopener): class Grab(web.urllib.URLopener):
def __init__(self, *args): def __init__(self, *args):
@ -58,10 +58,6 @@ def formatnumber(n):
def g(phenny, input): def g(phenny, input):
"""Queries Google for the specified input.""" """Queries Google for the specified input."""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
query = input.group(2) query = input.group(2)
if not query: if not query:
return phenny.reply('.g what?') return phenny.reply('.g what?')
@ -82,10 +78,6 @@ g.priority = 'high'
g.example = '.g minetest' g.example = '.g minetest'
def gc(phenny, input): def gc(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
if not input.group(2): if not input.group(2):
return phenny.reply("No query term.") return phenny.reply("No query term.")
query = input.group(2).encode('utf-8') query = input.group(2).encode('utf-8')

View File

@ -51,11 +51,7 @@ def pushupdate(sender, time, nick):
update_l.release() update_l.release()
def seen(phenny, input): def seen(phenny, input):
""".seen <nick> - Reports when <nick> was last seen.""" """seen <nick> - Reports when <nick> was last seen."""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
nick = input.group(2) nick = input.group(2)
if not nick: if not nick:
return phenny.reply("Need a nickname to search for...") return phenny.reply("Need a nickname to search for...")

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
server.py - Phenny Minetest Server Module server.py - Phenny Minetest Server Module
Copyright 2013, Sfan5 Copyright 2013, sfan5
""" """
import web, json, random import web, json, random
@ -174,11 +174,6 @@ def by_port(tbl, arg):
return results return results
def server(phenny, input): def server(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
arg = input.group(2) arg = input.group(2)
if not arg: if not arg:
cfuncs = [by_random] cfuncs = [by_random]

View File

@ -7,10 +7,6 @@ Copyright 2012, sfan5
import socket, time import socket, time
def serverup(phenny, input): def serverup(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
arg = input.group(2) arg = input.group(2)
if not arg: if not arg:
return phenny.reply("Give me a Server Address") return phenny.reply("Give me a Server Address")

View File

@ -6,10 +6,6 @@ Copyright 2013, sfan5
import urllib import urllib
def shorten(phenny, input): def shorten(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
arg = input.group(2) arg = input.group(2)
if not arg: if not arg:
arg = "" # Function continues and prints Help Message arg = "" # Function continues and prints Help Message

View File

@ -15,10 +15,6 @@ import json
def rtfm(phenny, input): def rtfm(phenny, input):
"""Manual reference command""" """Manual reference command"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return
if input.group(2): if input.group(2):
u = input.group(2).strip() + ", " u = input.group(2).strip() + ", "
else: else:
@ -29,10 +25,6 @@ rtfm.commands = ['rtfm']
def questions(phenny, input): def questions(phenny, input):
"""Ask smart questions""" """Ask smart questions"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return
if input.group(2): if input.group(2):
u = input.group(2).strip() + ", " u = input.group(2).strip() + ", "
else: else:
@ -43,10 +35,6 @@ questions.commands = ['questions']
def next(phenny, input): def next(phenny, input):
"""Next one please""" """Next one please"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return
phenny.say("Another satisfied customer. Next!") phenny.say("Another satisfied customer. Next!")
next.commands = ['next'] next.commands = ['next']
@ -67,10 +55,6 @@ pil.commands = ['pil']
def git(phenny, input): def git(phenny, input):
"""Git Manual link""" """Git Manual link"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return
if input.group(2): if input.group(2):
u = input.group(2).strip() + ", " u = input.group(2).strip() + ", "
else: else:
@ -81,10 +65,6 @@ git.commands = ['git']
def stfu(phenny, input): def stfu(phenny, input):
"""usage: !stfu [nick]""" """usage: !stfu [nick]"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return
if input.group(2): if input.group(2):
u = input.group(2).strip() + ", " u = input.group(2).strip() + ", "
else: else:
@ -95,10 +75,6 @@ stfu.commands = ['stfu']
def proc(phenny, input): def proc(phenny, input):
"""usage: !proc [nick]""" """usage: !proc [nick]"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return
if input.group(2): if input.group(2):
u = input.group(2).strip() + ", " u = input.group(2).strip() + ", "
else: else:
@ -109,10 +85,6 @@ proc.commands = ['proc']
def doge(phenny, input): def doge(phenny, input):
"""much wow, very function, such programming""" """much wow, very function, such programming"""
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return
if random.randint(0, 1) == 0: if random.randint(0, 1) == 0:
f = urllib2.urlopen('http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=132') f = urllib2.urlopen('http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=132')
data = f.read() data = f.read()
@ -143,5 +115,3 @@ def btc(phenny, input):
phenny.say('1 BTC = %.4f %s' % (data[currency]['15m'], data[currency]['symbol'])) phenny.say('1 BTC = %.4f %s' % (data[currency]['15m'], data[currency]['symbol']))
btc.commands = ['btc'] btc.commands = ['btc']

View File

@ -31,10 +31,6 @@ def tell_diskwr():
tell_pending = [] tell_pending = []
def tell(phenny, input): def tell(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
arg = input.group(2) arg = input.group(2)
if not arg: if not arg:
return phenny.reply("Need a nickname...") return phenny.reply("Need a nickname...")

View File

@ -13,10 +13,6 @@ import re, urllib2, urlparse
r_title = re.compile(r'(?ims)<title[^>]*>(.*?)</title\s*>') r_title = re.compile(r'(?ims)<title[^>]*>(.*?)</title\s*>')
def f_title(phenny, input): def f_title(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
uri = input.group(2) uri = input.group(2)
uri = (uri or '').encode('utf-8') uri = (uri or '').encode('utf-8')

View File

@ -2,7 +2,7 @@
""" """
twitter.py - Phenny Twitter Module twitter.py - Phenny Twitter Module
Copyright 2012, Sean B. Palmer, inamidst.com Copyright 2012, Sean B. Palmer, inamidst.com
Modified by Sfan5 2012 Modified by sfan5 2012
Licensed under the Eiffel Forum License 2. Licensed under the Eiffel Forum License 2.
http://inamidst.com/phenny/ http://inamidst.com/phenny/
@ -69,10 +69,6 @@ def id_tweet(tid):
return "Sorry, couldn't get a tweet from %s" % link return "Sorry, couldn't get a tweet from %s" % link
def twitter(phenny, input): def twitter(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
arg = input.group(2) arg = input.group(2)
if not arg: if not arg:
return phenny.reply("Give me a link, a @username, or a tweet id") return phenny.reply("Give me a link, a @username, or a tweet id")

View File

@ -2,7 +2,7 @@
""" """
wiki.py - Phenny Wiki Module wiki.py - Phenny Wiki Module
Copyright 2008-9, Sean B. Palmer, inamidst.com Copyright 2008-9, Sean B. Palmer, inamidst.com
Modified by Sfan5 2013 Modified by sfan5 2013
Licensed under the Eiffel Forum License 2. Licensed under the Eiffel Forum License 2.
http://inamidst.com/phenny/ http://inamidst.com/phenny/
@ -132,10 +132,6 @@ def wikipedia(term, language='en', last=False):
return sentence + ' - ' + (wikiuri % (term)) return sentence + ' - ' + (wikiuri % (term))
def wik(phenny, input): def wik(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
origterm = input.groups()[1] origterm = input.groups()[1]
if not origterm: if not origterm:
return phenny.say('Perhaps you meant "!wik Zen"?') return phenny.say('Perhaps you meant "!wik Zen"?')