diff options
-rw-r--r-- | IRC.py | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/IRC.py b/IRC.py index 5f8d09e..9be5d26 100644 --- a/IRC.py +++ b/IRC.py @@ -16,25 +16,8 @@ def create_sasl_plain_auth(username, password): return base64_auth -def decode_sasl_plain_auth(base64_auth): - """ - Decode a SASL PLAIN authentication string for verification. - - Args: - base64_auth (str): Base64 encoded SASL PLAIN authentication string - - Returns: - tuple: (authorization_identity, username, password) - """ - # Decode base64 - auth_bytes = base64.b64decode(base64_auth) - auth_string = auth_bytes.decode("utf-8") - - # Split on null bytes - parts = auth_string.split("\x00") - - # Return the three components - return tuple(parts) +def encode_action_message(m): + return f"\x01ACTION {m}\x01" class IRCBadMessage(Exception): @@ -97,6 +80,7 @@ class IRCBot: self.send_cmd(authmsg) joinmsg = irctokens.build("JOIN", [self.config["channel"]]) self.send_cmd(joinmsg) + self.send_action("Hops in", self.config["channel"]) def send_privmsg(self, dst, msg): msg = irctokens.build("PRIVMSG", [dst, msg]) @@ -108,7 +92,9 @@ class IRCBot: self.send_cmd(msg) def send_action(self, action_msg, dst): - pass + em = encode_action_message(action_msg) + ctcpmsg = irctokens.build("PRIVMSG", [dst, em]) + self.send_cmd(ctcpmsg) def connect(self, server, port, channel, botnick, botnickpass): if self.config is None: |