aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jesopo2019-11-27 17:38:17 +0000
committerGravatar jesopo2019-11-27 17:38:17 +0000
commit747ba5c646d2755cb3ab48bbe98032752723e8c6 (patch)
tree20870d3087aadcbbcb3eda504b301c9401cbfcae /src
parentshow username when a toot is CWed (diff)
signature
add IRCLine.parse_human() to allow for "!raw /msg jesopo hello"
Diffstat (limited to 'src')
-rw-r--r--src/IRCLine.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/IRCLine.py b/src/IRCLine.py
index 9f120e10..62d9e8b7 100644
--- a/src/IRCLine.py
+++ b/src/IRCLine.py
@@ -197,6 +197,15 @@ def parse_line(line: str) -> ParsedLine:
args.append(typing.cast(str, trailing))
return ParsedLine(command, args, source, tags)
+def is_human(line: str):
+ return len(line) > 1 and line[0] == "/"
+def parse_human(line: str) -> typing.Optional[ParsedLine]:
+ command, _, args = line[1:].partition(" ")
+ if command == "msg":
+ target, _, message = args.partition(" ")
+ return ParsedLine("PRIVMSG", [target, message])
+ return None
+
class SentLine(IRCObject.Object):
def __init__(self, events: "EventManager.Events",
send_time: datetime.datetime, hostmask: str, line: ParsedLine):