public void Close() { foreach (var channel in ActiveChannels) { channel.Value.ShutdownTask(); } MeebyIrcClient.Disconnect(); System.Threading.Thread.Sleep(2000); IsRunning = false; this.OnShutdown(); }
private void IrcClient_OnConnected(object sender, EventArgs e) { Console.WriteLine("Connected!"); ErrorLogging.WriteLine("Connected!"); MeebyIrcClient.Login(BotConnectionConfig.Username, BotConnectionConfig.Username, 4, BotConnectionConfig.Username, "oauth:" + BotConnectionConfig.Password); Thread.Sleep(2000); //Request capabilities - https://dev.twitch.tv/docs/irc/guide/#twitch-irc-capabilities MeebyIrcClient.WriteLine("CAP REQ :twitch.tv/tags twitch.tv/commands twitch.tv/membership"); Thread.Sleep(2000); foreach (var channel in BotCoreConfig.ChannelsToJoin) { ConnectToChannel(channel, Storage.ChannelConfig.Load(channel)); Thread.Sleep(2000); //Since Twitch doesn't like mass joining } }
internal void LeaveChannel(string channelToLeave) { this.OnChannelLeaving?.Invoke(channelToLeave); MeebyIrcClient.RfcPart("#" + channelToLeave); }
public void ConnectToChannel(string channelToJoin, Storage.ChannelConfig channelcfg) { MeebyIrcClient.RfcJoin("#" + channelToJoin); this.OnChannelJoining?.Invoke(channelToJoin); ActiveChannels.Add("#" + channelToJoin, new SuiBot_ChannelInstance(channelToJoin, BotConnectionConfig.Password, this, channelcfg)); }