diff --git a/bot.py b/bot.py index 1dd3823..e34c571 100644 --- a/bot.py +++ b/bot.py @@ -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 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))) # Responds to server Pings. -def pong(ircsock): - ircsock.send("PONG :pingis\n") +def pong(ircsock, ircmsg): + response = "PONG :" + ircmsg.split("PING :")[1] + "\n" + ircsock.send(response) ########################## diff --git a/test_bot.py b/test_bot.py index 682a709..5dc72c6 100644 --- a/test_bot.py +++ b/test_bot.py @@ -194,7 +194,7 @@ class TestMessageResponse(unittest.TestCase): 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 - self.assertEqual(self.ircsock.sent_message(),"PONG :pingis\n") + self.assertEqual(self.ircsock.sent_message(),"PONG :\n") 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