From 1fe63aad9ad5146424897846e300e17faef9be06 Mon Sep 17 00:00:00 2001
From: FG <fgmikuczanis@gmail.com>
Date: Mon, 20 Feb 2023 19:13:05 +0100
Subject: [PATCH] Adding Join & Leave channel

---
 .../Assets/Package/Runtime/IRC.cs             | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/Unity-Twitch-Chat/Assets/Package/Runtime/IRC.cs b/Unity-Twitch-Chat/Assets/Package/Runtime/IRC.cs
index 71fb7c5..1d95779 100644
--- a/Unity-Twitch-Chat/Assets/Package/Runtime/IRC.cs
+++ b/Unity-Twitch-Chat/Assets/Package/Runtime/IRC.cs
@@ -296,5 +296,25 @@ public void SendChatMessage(string message)
 
             connection.SendChatMessage(message);
         }
+
+        /// <summary>
+        /// Join a new channel
+        /// </summary>
+        /// <param name="channel">The channel to join</param>
+        public void JoinChannel(string channel) 
+        {
+            if (channel != "")
+                connection.SendCommand("JOIN #" + channel.ToLower(), true);
+        }
+
+        /// <summary>
+        /// Leaves a channel
+        /// </summary>
+        /// <param name="channel">The channel to leave</param>
+        public void LeaveChannel(string channel) 
+        {
+            if (channel != "")
+                connection.SendCommand("PART #" + channel.ToLower(), true);
+        }
     }
 }
\ No newline at end of file