diff --git a/src/IRCChannel.py b/src/IRCChannel.py index 028a51b7..fbb47cfb 100644 --- a/src/IRCChannel.py +++ b/src/IRCChannel.py @@ -210,6 +210,8 @@ class Channel(IRCObject.Object): def send_message(self, text: str, tags: dict={}): return self.server.send_message(self.name, text, tags=tags) + def send_action(self, text: str, tags: dict={}): + return self.server.send_action(self.name, text, tags=tags) def send_notice(self, text: str, tags: dict={}): return self.server.send_notice(self.name, text, tags=tags) def send_tagmsg(self, tags: dict): diff --git a/src/IRCServer.py b/src/IRCServer.py index fa4d86fc..bb22adab 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -390,6 +390,10 @@ class Server(IRCObject.Object): def send_message(self, target: str, message: str, tags: dict={} ) -> typing.Optional[IRCLine.SentLine]: return self.send(self._line("PRIVMSG", [target, message], tags=tags)) + def send_action(self, target: str, message: str, tags: dict={} + ) -> typing.Optional[IRCLine.SentLine]: + return self.send(self._line("PRIVMSG", + [target, f"\x01ACTION {message}\x01"], tags=tags)) def send_notice(self, target: str, message: str, tags: dict={} ) -> typing.Optional[IRCLine.SentLine]: diff --git a/src/IRCUser.py b/src/IRCUser.py index 2e141794..6db124f0 100644 --- a/src/IRCUser.py +++ b/src/IRCUser.py @@ -77,6 +77,8 @@ class User(IRCObject.Object): def send_message(self, message: str, tags: dict={}): self.server.send_message(self.nickname, message, tags=tags) + def send_action(self, message: str, tags: dict={}): + self.server.send_action(self.nickname, message, tags=tags) def send_notice(self, text: str, tags: dict={}): self.server.send_notice(self.nickname, text, tags=tags) def send_ctcp_response(self, command: str, args: str):