Also strip \x01 off the start of CTCP commands, if it's there (utils.irc)

This commit is contained in:
jesopo 2019-02-12 16:49:24 +00:00
parent b2d942027e
commit b4092a14ca

View file

@ -281,6 +281,8 @@ def parse_ctcp(s: str) -> typing.Optional[CTCPMessage]:
ctcp = s.startswith("\x01")
if s.startswith("\x01"):
ctcp_command, sep, ctcp_message = s[1:].partition(" ")
if ctcp_command.endswith("\x01"):
ctcp_command = ctcp_command[:-1]
if ctcp_message.endswith("\x01"):
ctcp_message = ctcp_message[:-1]
return CTCPMessage(ctcp_command, ctcp_message)