Attempt to fix response to pong

This commit is contained in:
Shauna 2015-04-09 12:14:07 -04:00
parent 89059050a4
commit 6e25557946
2 changed files with 5 additions and 4 deletions

7
bot.py
View File

@ -174,7 +174,7 @@ def message_response(bot, ircmsg, actor, ircsock, channel, greeters):
# If the server pings us then we've got to respond! # If the server pings us then we've got to respond!
if ircmsg.find("PING :") != -1: if ircmsg.find("PING :") != -1:
pong(ircsock) pong(ircsock, ircmsg)
############################################################# #############################################################
@ -219,8 +219,9 @@ def wait_time_change(actor, ircmsg, ircsock, channel, channel_greeters):
"assistance.\n".format(channel, actor, greeter_string(channel_greeters))) "assistance.\n".format(channel, actor, greeter_string(channel_greeters)))
# Responds to server Pings. # Responds to server Pings.
def pong(ircsock): def pong(ircsock, ircmsg):
ircsock.send("PONG :pingis\n") response = "PONG :" + ircmsg.split("PING :")[1] + "\n"
ircsock.send(response)
########################## ##########################

View File

@ -194,7 +194,7 @@ class TestMessageResponse(unittest.TestCase):
def test_pong(self): def test_pong(self):
botcode.message_response(self.bot,"PING :","Shauna",ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Replace this with actual ping message botcode.message_response(self.bot,"PING :","Shauna",ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Replace this with actual ping message
self.assertEqual(self.ircsock.sent_message(),"PONG :pingis\n") self.assertEqual(self.ircsock.sent_message(),"PONG :\n")
def test_bad_pong(self): def test_bad_pong(self):
botcode.message_response(self.bot,"PING!!! :","Shauna",ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Replace this with actual ping message botcode.message_response(self.bot,"PING!!! :","Shauna",ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Replace this with actual ping message