mirror of
https://github.com/RussellChamp/tilde-projects.git
synced 2026-10-28 00:22:34 +00:00
Added some stuff, deleted some stuff, modified some stuff
This commit is contained in:
1 parent
8454515e67
commit
d76dd9c674
16 files changed
+199
-30
No files matched your search
+40
-1
@@ -9,6 +9,7 @@ from optparse import OptionParser
|
||||
import fileinput
|
||||
import random
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
import formatter
|
||||
import get_users
|
||||
@@ -23,6 +24,8 @@ import welch
|
||||
import evil
|
||||
import tumblr
|
||||
import xkcdApropos
|
||||
import wikiphilosophy
|
||||
import acronymFinder
|
||||
|
||||
parser = OptionParser()
|
||||
|
||||
@@ -126,6 +129,7 @@ def get_rhymes(channel, user, text):
|
||||
|
||||
def define_word(channel, user, text):
|
||||
word = ""
|
||||
defs = []
|
||||
if(len(text.split(' ')) > 1):
|
||||
word = text.split(' ')[1]
|
||||
defs = defWord(word)
|
||||
@@ -143,7 +147,7 @@ def get_welch(channel):
|
||||
ircsock.send("PRIVMSG " + channel + " :" + welch.get_thing()[0:400] + "\n")
|
||||
|
||||
def get_evil(channel):
|
||||
evilThing = evil.get_thing();
|
||||
evilThing = evil.get_thing()
|
||||
for line in [evilThing[i:i+400] for i in range(0, len(evilThing), 400)]:
|
||||
ircsock.send("PRIVMSG " + channel + " :" + line + "\n")
|
||||
|
||||
@@ -160,6 +164,33 @@ def get_xkcd(channel, text):
|
||||
#res = xkcdApropos.xkcd(text[6:])
|
||||
#ircsock.send("PRIVMSG " + channel + " :" + res + "\n")
|
||||
|
||||
def get_wphilosophy(channel, text):
|
||||
steps = wikiphilosophy.get_philosophy_lower(text[17:])
|
||||
if not steps:
|
||||
ircsock.send("PRIVMSG " + channel + " :Couldn't find a wikipedia entry for " + text + "\n")
|
||||
else:
|
||||
joined_steps = ' > '.join(steps)
|
||||
if steps[-1] == 'Philosophy':
|
||||
joined_steps += "!!!"
|
||||
for line in [joined_steps[i:i+400] for i in range(0, len(joined_steps), 400)]:
|
||||
ircsock.send("PRIVMSG " + channel + " :" + line + "\n")
|
||||
|
||||
def figlet(channel, text):
|
||||
if not text:
|
||||
ircsock.send("PRIVMSG " + channel + " :No text given. :(\n")
|
||||
else:
|
||||
lines = subprocess.Popen(["figlet", "-w80"] + text.split(' '), shell=False, stdout=subprocess.PIPE).stdout.read()
|
||||
for line in lines.split('\n'):
|
||||
ircsock.send("PRIVMSG " + channel + " :" + line + "\n")
|
||||
|
||||
def get_acronym(channel, text):
|
||||
if not text:
|
||||
ircsock.send("PRIVMSG " + channel + " :No text given :(\n")
|
||||
else:
|
||||
defs = acronymFinder.get_acros(text)
|
||||
for d in defs[0:5]: #only the first five. they are already sorted by 'score'
|
||||
ircsock.send("PRIVMSG " + channel + " :" + d + "\n")
|
||||
|
||||
def rollcall(channel):
|
||||
ircsock.send("PRIVMSG "+ channel +" :U wot m8? I score all the top drawer #banter and #bantz on this channel! Find new top-shelf banter with !newbanter, !rhymes, and !define. Make your chatter #legend with !rainbow and get jokes with !welch and !evil\n")
|
||||
|
||||
@@ -231,6 +262,14 @@ def listen():
|
||||
|
||||
if ircmsg.find("!xkcd") != -1:
|
||||
get_xkcd(channel, messageText)
|
||||
if ircmsg.find("!wiki-philosophy") != -1:
|
||||
get_wphilosophy(channel, messageText);
|
||||
|
||||
if ircmsg.find("!figlet") != -1:
|
||||
figlet(channel, messageText[8:])
|
||||
|
||||
if ircmsg.find("!acronym") != -1:
|
||||
get_acronym(channel, messageText[9:])
|
||||
|
||||
if ircmsg.find(":!rollcall") != -1:
|
||||
rollcall(channel)
|
||||
|
||||
Reference in new issue
Block a user