Attempt to fix response to pong
This commit is contained in:
parent
89059050a4
commit
6e25557946
7
bot.py
7
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 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)
|
||||||
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user