might as well fix all bots
This commit is contained in:
parent
464299a6af
commit
1019270dc2
|
@ -43,8 +43,8 @@ parser.add_option("-n", "--nick", dest="nick", default='tildebot',
|
||||||
|
|
||||||
p = inflect.engine()
|
p = inflect.engine()
|
||||||
|
|
||||||
def ping():
|
def ping(pong):
|
||||||
ircsock.send("PONG :pingis\n")
|
ircsock.send("PONG {}\n".format(pong))
|
||||||
|
|
||||||
def sendmsg(chan , msg):
|
def sendmsg(chan , msg):
|
||||||
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
||||||
|
@ -263,8 +263,8 @@ def listen(botnick):
|
||||||
ircmsg = ircsock.recv(2048)
|
ircmsg = ircsock.recv(2048)
|
||||||
ircmsg = ircmsg.strip('\n\r')
|
ircmsg = ircmsg.strip('\n\r')
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
formatted = formatter.format_message(ircmsg)
|
formatted = formatter.format_message(ircmsg)
|
||||||
|
|
||||||
|
@ -337,8 +337,8 @@ def listen(botnick):
|
||||||
if ircmsg.find(":" + botnick + ":") != -1:
|
if ircmsg.find(":" + botnick + ":") != -1:
|
||||||
mug_off(channel)
|
mug_off(channel)
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
|
@ -25,7 +25,7 @@ class State:
|
||||||
MAX_LINE = 80 # The maximum number of characters in a line
|
MAX_LINE = 80 # The maximum number of characters in a line
|
||||||
MAX_STORIES = 5 # The maximum number of stories a user can pick from
|
MAX_STORIES = 5 # The maximum number of stories a user can pick from
|
||||||
THROTTLE_FACTOR = 1 # A factor by which all sleep event durations will be multiplied
|
THROTTLE_FACTOR = 1 # A factor by which all sleep event durations will be multiplied
|
||||||
# Allow madlbibbot to run multiple simultaneous stories
|
# Allow madlbibbot to run multiple simultaneous stories
|
||||||
state = {} # The current state of the bot
|
state = {} # The current state of the bot
|
||||||
stories = {} # The list of stories available to users
|
stories = {} # The list of stories available to users
|
||||||
story = {} # The madlib story currently being worked on
|
story = {} # The madlib story currently being worked on
|
||||||
|
@ -179,8 +179,8 @@ def finish_story(channel):
|
||||||
state[channel] = State.idle
|
state[channel] = State.idle
|
||||||
|
|
||||||
# System things
|
# System things
|
||||||
def ping():
|
def ping(pong):
|
||||||
ircsock.send("PONG :pingis\n")
|
ircsock.send("PONG {}\n".format(pong))
|
||||||
|
|
||||||
def sendmsg(chan , msg):
|
def sendmsg(chan , msg):
|
||||||
ircsock.send("PRIVMSG {} :{}\n".format(chan, msg))
|
ircsock.send("PRIVMSG {} :{}\n".format(chan, msg))
|
||||||
|
@ -212,8 +212,8 @@ def listen(botnick):
|
||||||
ircmsg = ircsock.recv(2048)
|
ircmsg = ircsock.recv(2048)
|
||||||
ircmsg = ircmsg.strip('\n\r')
|
ircmsg = ircmsg.strip('\n\r')
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
formatted = msgformatter.format_message(ircmsg)
|
formatted = msgformatter.format_message(ircmsg)
|
||||||
if "" == formatted:
|
if "" == formatted:
|
||||||
|
|
|
@ -22,11 +22,11 @@ parser.add_option("-n", "--nick", dest="nick", default='quote_bot',
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
def ping():
|
def ping(pong):
|
||||||
ircsock.send("PONG :pingis\n")
|
ircsock.send("PONG {}\n".format(pong))
|
||||||
|
|
||||||
def sendmsg(chan , msg):
|
def sendmsg(chan , msg):
|
||||||
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
||||||
|
|
||||||
def joinchan(chan):
|
def joinchan(chan):
|
||||||
ircsock.send("JOIN "+ chan +"\n")
|
ircsock.send("JOIN "+ chan +"\n")
|
||||||
|
@ -74,21 +74,21 @@ def say_chatty(channel):
|
||||||
for line in chattyOut:
|
for line in chattyOut:
|
||||||
if line:
|
if line:
|
||||||
ircsock.send("PRIVMSG "+ channel + " :" + line + "\n")
|
ircsock.send("PRIVMSG "+ channel + " :" + line + "\n")
|
||||||
|
|
||||||
def listen():
|
def listen():
|
||||||
while 1:
|
while 1:
|
||||||
|
|
||||||
ircmsg = ircsock.recv(2048)
|
ircmsg = ircsock.recv(2048)
|
||||||
ircmsg = ircmsg.strip('\n\r')
|
ircmsg = ircmsg.strip('\n\r')
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
formatted = formatter.format_message(ircmsg)
|
formatted = formatter.format_message(ircmsg)
|
||||||
|
|
||||||
if "" == formatted:
|
if "" == formatted:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print formatted
|
print formatted
|
||||||
|
|
||||||
split = formatted.split("\t")
|
split = formatted.split("\t")
|
||||||
|
@ -108,8 +108,8 @@ def listen():
|
||||||
if ircmsg.find(":!haiku") != -1:
|
if ircmsg.find(":!haiku") != -1:
|
||||||
haiku(options.channel)
|
haiku(options.channel)
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
|
@ -22,11 +22,11 @@ parser.add_option("-n", "--nick", dest="nick", default='tilde_bot',
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
def ping():
|
def ping(pong):
|
||||||
ircsock.send("PONG :pingis\n")
|
ircsock.send("PONG {}\n".format(pong))
|
||||||
|
|
||||||
def sendmsg(chan , msg):
|
def sendmsg(chan , msg):
|
||||||
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
||||||
|
|
||||||
def joinchan(chan):
|
def joinchan(chan):
|
||||||
ircsock.send("JOIN "+ chan +"\n")
|
ircsock.send("JOIN "+ chan +"\n")
|
||||||
|
@ -61,14 +61,14 @@ def listen():
|
||||||
ircmsg = ircsock.recv(2048)
|
ircmsg = ircsock.recv(2048)
|
||||||
ircmsg = ircmsg.strip('\n\r')
|
ircmsg = ircmsg.strip('\n\r')
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
formatted = formatter.format_message(ircmsg)
|
formatted = formatter.format_message(ircmsg)
|
||||||
|
|
||||||
if "" == formatted:
|
if "" == formatted:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print formatted
|
print formatted
|
||||||
|
|
||||||
split = formatted.split("\t")
|
split = formatted.split("\t")
|
||||||
|
@ -79,8 +79,8 @@ def listen():
|
||||||
if ircmsg.find(":!tilde") != -1:
|
if ircmsg.find(":!tilde") != -1:
|
||||||
tilde(options.channel, user, time)
|
tilde(options.channel, user, time)
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ parser.add_option("-n", "--nick", dest="nick", default='topicbot',
|
||||||
|
|
||||||
p = inflect.engine()
|
p = inflect.engine()
|
||||||
|
|
||||||
def ping():
|
def ping(pong):
|
||||||
ircsock.send("PONG :pingis\n")
|
ircsock.send("PONG {}\n".format(pong))
|
||||||
|
|
||||||
def sendmsg(chan , msg):
|
def sendmsg(chan , msg):
|
||||||
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
||||||
|
@ -145,8 +145,8 @@ def listen():
|
||||||
ircmsg = ircsock.recv(2048)
|
ircmsg = ircsock.recv(2048)
|
||||||
ircmsg = ircmsg.strip('\n\r')
|
ircmsg = ircmsg.strip('\n\r')
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
formatted = formatter.format_message(ircmsg)
|
formatted = formatter.format_message(ircmsg)
|
||||||
|
|
||||||
|
@ -187,8 +187,8 @@ def listen():
|
||||||
if ircmsg.find(":!rollcall") != -1:
|
if ircmsg.find(":!rollcall") != -1:
|
||||||
rollcall(channel)
|
rollcall(channel)
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
|
@ -56,8 +56,8 @@ def resetGlobals():
|
||||||
currentScores.clear()
|
currentScores.clear()
|
||||||
|
|
||||||
|
|
||||||
def ping():
|
def ping(pong):
|
||||||
ircsock.send("PONG :pingis\n")
|
ircsock.send("PONG {}\n".format(pong))
|
||||||
|
|
||||||
def sendmsg(chan , msg):
|
def sendmsg(chan , msg):
|
||||||
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
|
||||||
|
@ -220,8 +220,8 @@ def listen():
|
||||||
ircmsg = ircsock.recv(2048)
|
ircmsg = ircsock.recv(2048)
|
||||||
ircmsg = ircmsg.strip('\n\r')
|
ircmsg = ircmsg.strip('\n\r')
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
formatted = formatter.format_message(ircmsg)
|
formatted = formatter.format_message(ircmsg)
|
||||||
|
|
||||||
|
@ -254,8 +254,8 @@ def listen():
|
||||||
if ircmsg.find(":!rollcall") != -1:
|
if ircmsg.find(":!rollcall") != -1:
|
||||||
rollcall(channel)
|
rollcall(channel)
|
||||||
|
|
||||||
if ircmsg.find("PING :") != -1:
|
if ircmsg[:4] == "PING":
|
||||||
ping()
|
ping(ircmsg.split(" ")[1])
|
||||||
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
Loading…
Reference in New Issue