Compare commits
3 Commits
128ff2f481
...
a368246de7
Author | SHA1 | Date |
---|---|---|
pitchum | a368246de7 | |
pitchum | 211598633f | |
pitchum | 70379d7c3e |
|
@ -14,7 +14,7 @@ import feedparser
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
logging.basicConfig(level=logging.INFO,
|
logging.basicConfig(level=logging.INFO,
|
||||||
format="%(asctime)s %(levelname)s %(threadName)s %(name)s %(message)s")
|
format="%(levelname)s %(threadName)s %(name)s %(message)s")
|
||||||
|
|
||||||
# Help configuration.
|
# Help configuration.
|
||||||
HELP_LIST = ["help", "faq", "aide"]
|
HELP_LIST = ["help", "faq", "aide"]
|
||||||
|
@ -94,11 +94,11 @@ def parse_irc_messages(irc_msg: str) -> Tuple[str, str, str]:
|
||||||
try:
|
try:
|
||||||
target = irc_msg.split(":")[1].split(" ")[2]
|
target = irc_msg.split(":")[1].split(" ")[2]
|
||||||
except Exception:
|
except Exception:
|
||||||
LOGGER.exception("Exception raised to irc message parsing")
|
LOGGER.warning("Failed to parse target for actor='{}' in the following incoming irc message: {}".format(actor, irc_msg))
|
||||||
target = None
|
target = None
|
||||||
return " ".join(irc_msg.split()), actor, target
|
return " ".join(irc_msg.split()), actor, target
|
||||||
except Exception:
|
except Exception:
|
||||||
LOGGER.exception("Exception raised to irc message parsing")
|
LOGGER.exception("Failed to parse the following incoming irc message: {}".format(irc_msg))
|
||||||
return None, None, None
|
return None, None, None
|
||||||
|
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue