might as well fix all bots

This commit is contained in:
Ben Harris 2018-10-05 13:56:15 -04:00
parent 464299a6af
commit 1019270dc2
6 changed files with 42 additions and 42 deletions

View File

@ -43,8 +43,8 @@ parser.add_option("-n", "--nick", dest="nick", default='tildebot',
p = inflect.engine()
def ping():
ircsock.send("PONG :pingis\n")
def ping(pong):
ircsock.send("PONG {}\n".format(pong))
def sendmsg(chan , msg):
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
@ -263,8 +263,8 @@ def listen(botnick):
ircmsg = ircsock.recv(2048)
ircmsg = ircmsg.strip('\n\r')
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
formatted = formatter.format_message(ircmsg)
@ -337,8 +337,8 @@ def listen(botnick):
if ircmsg.find(":" + botnick + ":") != -1:
mug_off(channel)
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
sys.stdout.flush()
time.sleep(1)

View File

@ -25,7 +25,7 @@ class State:
MAX_LINE = 80 # The maximum number of characters in a line
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
# Allow madlbibbot to run multiple simultaneous stories
# Allow madlbibbot to run multiple simultaneous stories
state = {} # The current state of the bot
stories = {} # The list of stories available to users
story = {} # The madlib story currently being worked on
@ -179,8 +179,8 @@ def finish_story(channel):
state[channel] = State.idle
# System things
def ping():
ircsock.send("PONG :pingis\n")
def ping(pong):
ircsock.send("PONG {}\n".format(pong))
def sendmsg(chan , msg):
ircsock.send("PRIVMSG {} :{}\n".format(chan, msg))
@ -212,8 +212,8 @@ def listen(botnick):
ircmsg = ircsock.recv(2048)
ircmsg = ircmsg.strip('\n\r')
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
formatted = msgformatter.format_message(ircmsg)
if "" == formatted:

View File

@ -22,11 +22,11 @@ parser.add_option("-n", "--nick", dest="nick", default='quote_bot',
(options, args) = parser.parse_args()
def ping():
ircsock.send("PONG :pingis\n")
def ping(pong):
ircsock.send("PONG {}\n".format(pong))
def sendmsg(chan , msg):
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
def joinchan(chan):
ircsock.send("JOIN "+ chan +"\n")
@ -74,21 +74,21 @@ def say_chatty(channel):
for line in chattyOut:
if line:
ircsock.send("PRIVMSG "+ channel + " :" + line + "\n")
def listen():
while 1:
ircmsg = ircsock.recv(2048)
ircmsg = ircmsg.strip('\n\r')
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
formatted = formatter.format_message(ircmsg)
if "" == formatted:
continue
print formatted
split = formatted.split("\t")
@ -108,8 +108,8 @@ def listen():
if ircmsg.find(":!haiku") != -1:
haiku(options.channel)
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
sys.stdout.flush()
time.sleep(1)

View File

@ -22,11 +22,11 @@ parser.add_option("-n", "--nick", dest="nick", default='tilde_bot',
(options, args) = parser.parse_args()
def ping():
ircsock.send("PONG :pingis\n")
def ping(pong):
ircsock.send("PONG {}\n".format(pong))
def sendmsg(chan , msg):
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
def joinchan(chan):
ircsock.send("JOIN "+ chan +"\n")
@ -61,14 +61,14 @@ def listen():
ircmsg = ircsock.recv(2048)
ircmsg = ircmsg.strip('\n\r')
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
formatted = formatter.format_message(ircmsg)
if "" == formatted:
continue
print formatted
split = formatted.split("\t")
@ -79,8 +79,8 @@ def listen():
if ircmsg.find(":!tilde") != -1:
tilde(options.channel, user, time)
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
sys.stdout.flush()

View File

@ -30,8 +30,8 @@ parser.add_option("-n", "--nick", dest="nick", default='topicbot',
p = inflect.engine()
def ping():
ircsock.send("PONG :pingis\n")
def ping(pong):
ircsock.send("PONG {}\n".format(pong))
def sendmsg(chan , msg):
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
@ -145,8 +145,8 @@ def listen():
ircmsg = ircsock.recv(2048)
ircmsg = ircmsg.strip('\n\r')
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
formatted = formatter.format_message(ircmsg)
@ -187,8 +187,8 @@ def listen():
if ircmsg.find(":!rollcall") != -1:
rollcall(channel)
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
sys.stdout.flush()
time.sleep(1)

View File

@ -56,8 +56,8 @@ def resetGlobals():
currentScores.clear()
def ping():
ircsock.send("PONG :pingis\n")
def ping(pong):
ircsock.send("PONG {}\n".format(pong))
def sendmsg(chan , msg):
ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
@ -220,8 +220,8 @@ def listen():
ircmsg = ircsock.recv(2048)
ircmsg = ircmsg.strip('\n\r')
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
formatted = formatter.format_message(ircmsg)
@ -254,8 +254,8 @@ def listen():
if ircmsg.find(":!rollcall") != -1:
rollcall(channel)
if ircmsg.find("PING :") != -1:
ping()
if ircmsg[:4] == "PING":
ping(ircmsg.split(" ")[1])
sys.stdout.flush()
time.sleep(1)