Make sure we respond to ping.

This commit is contained in:
pitchum 2023-05-10 13:37:30 +02:00 committed by root
parent 70379d7c3e
commit 211598633f

View File

@ -156,6 +156,13 @@ class Bot:
if ready_to_read: if ready_to_read:
last_read = datetime.utcnow() last_read = datetime.utcnow()
irc_msg = self.msg_handler() irc_msg = self.msg_handler()
# If the server pings us then we've got to respond!
if irc_msg.find("PING :") != -1:
self.pong(irc_msg)
LOGGER.info("Responding to ping message: {}".format(irc_msg))
continue
irc_msg, actor, channel = parse_irc_messages(irc_msg) irc_msg, actor, channel = parse_irc_messages(irc_msg)
if irc_msg is not None: if irc_msg is not None:
@ -208,10 +215,6 @@ class Bot:
self._check_project_updates(channel) self._check_project_updates(channel)
self.send_privmsg(channel, "Fait !") self.send_privmsg(channel, "Fait !")
# If the server pings us then we've got to respond!
if irc_msg.find("PING :") != -1:
self.pong(irc_msg)
# Responds to a user that inputs "Hello Mybot". # Responds to a user that inputs "Hello Mybot".
def bot_hello(self, channel: str, greeting: str) -> None: def bot_hello(self, channel: str, greeting: str) -> None:
self.send_privmsg(channel, greeting) self.send_privmsg(channel, greeting)