예제 #1
0
 def test_parsing_irc_msg(self):
     raw_msg = ":[email protected] PRIVMSG #beginbot :hello"
     subject = IrcMsg(raw_msg)
     assert subject.user == "beginbot"
     assert subject.msg == "hello"
     assert not subject.is_command()
     assert subject.command is None
     assert subject.args == []
예제 #2
0
 def test_parsing_mixed_case_command(self):
     raw_msg = ":[email protected] PRIVMSG #beginbot :!Me"
     subject = IrcMsg(raw_msg)
     assert subject.user == "beginbot"
     assert subject.msg == "!Me"
     assert subject.is_command()
     assert subject.command == "me"
     assert subject.args == []
예제 #3
0
 def test_parsing_new_soundeffect_request(self):
     raw_msg = ":[email protected] PRIVMSG #beginbot :!soundeffect Mv0oYS-qMcQ update 0:00 0:01"
     subject = IrcMsg(raw_msg)
     assert subject.user == "beginbot"
     assert subject.msg == "!soundeffect Mv0oYS-qMcQ update 0:00 0:01"
     assert subject.is_command()
     assert subject.command == "soundeffect"
     assert subject.args == ["Mv0oYS-qMcQ", "update", "0:00", "0:01"]
예제 #4
0
 def test_parsing_command_msg_with_args(self):
     raw_msg = ":[email protected] PRIVMSG #beginbot :!add_perm clap fakeuser"
     subject = IrcMsg(raw_msg)
     assert subject.user == "beginbot"
     assert subject.msg == "!add_perm clap fakeuser"
     assert subject.is_command()
     assert subject.command == "add_perm"
     assert subject.args == ["clap", "fakeuser"]
예제 #5
0
 def test_parsing_command_msg(self):
     raw_msg = ":[email protected] PRIVMSG #beginbot :!clap"
     subject = IrcMsg(raw_msg)
     assert subject.user == "beginbot"
     assert subject.msg == "!clap"
     assert subject.is_command()
     assert subject.command == "clap"
     assert subject.args == []
예제 #6
0
 def __init__(self, irc_msg: List[str], logger: logging.Logger) -> None:
     self._logger = logger
     self.irc_msg = IrcMsg(irc_msg)
     self.user = self.irc_msg.user
     self.msg = self.irc_msg.msg
     self.command = self.irc_msg.command
     self.args = self.irc_msg.args