public AutomaticMessage(int timing,string text,IrcClient currentClient) { this.interval = timing; this.Message = text; this.showMessage = new Timer(this.interval); this.showMessage.Elapsed += ShowMessage_Elapsed; this.client = currentClient; }
public ircbot(string oauth, string channel,string nickname) { string[] textf2 = File.ReadAllLines(Environment.CurrentDirectory + @"\texts.txt",Encoding.Default); foreach (var c in textf2) { textf.Add(c); } channe = channel; client = new IrcClient("irc.twitch.tv", 6667); client.ServerPass = oauth; client.Nick = nickname; //client.ChannelMessage += client_ChannelMessage; client.OnConnect += client_OnConnect; client.Connect(); }
private void DoDisconnect() { btnConnect.Enabled = true; txtChannel.Enabled = true; txtPort.Enabled = true; txtServer.Enabled = true; txtNick.Enabled = true; lstUsers.Items.Clear(); txtSend.Enabled = false; btnSend.Enabled = false; client.Disconnect(); client = null; btnConnect.Text = "Connect"; }
private void DoConnect() { if (String.IsNullOrEmpty(txtServer.Text.Trim())) { MessageBox.Show("Please specify a server"); return; } if (String.IsNullOrEmpty(txtChannel.Text.Trim())) { MessageBox.Show("Please specify a channel"); return; } if (String.IsNullOrEmpty(txtNick.Text.Trim())) { MessageBox.Show("Please specify a nick"); return; } int port; if (Int32.TryParse(txtPort.Text, out port)) client = new IrcClient(txtServer.Text.Trim(), port); else client = new IrcClient(txtServer.Text.Trim()); AddEvents(); client.Nick = txtNick.Text.Trim(); btnConnect.Enabled = false; txtChannel.Enabled = false; txtPort.Enabled = false; txtServer.Enabled = false; txtNick.Enabled = false; rtbOutput.Clear(); // in case they reconnect and have old stuff there client.Connect(); }
private void ChatWorker_DoWork(object sender, DoWorkEventArgs e) { ircServerEnabled = false; ircPortEnabled = false; ircUsernameEnabled = false; ircOATHEnabled = false; saveLoginEnabled = false; btnLoginEnabled = false; progressBarVisible = true; if (ircServer == "" || ircPort == "" || ircUsername == "") { ircServerEnabled = true; ircPortEnabled = true; ircUsernameEnabled = true; ircOATHEnabled = true; saveLoginEnabled = true; btnLoginEnabled = true; progressBarVisible = false; mainWindowCallbacks.ShowMessage("Login Error", "Please make sure that all fields are filled in accordingly.", false); } else { client = new IrcClient(ircServer, Convert.ToInt32(ircPort)); client.AltNick = ircUsername; client.Nick = ircUsername; client.ServerPass = ircOATH; client.ChannelMessage += Client_ChannelMessage; client.NoticeMessage += Client_NoticeMessage; client.OnConnect += Client_OnConnect; client.PrivateMessage += Client_PrivateMessage; client.ServerMessage += Client_ServerMessage; client.UserJoined += Client_UserJoined; client.UserLeft += Client_UserLeft; client.UserNickChange += Client_UserNickChange; client.UpdateUsers += Client_UpdateUsers; client.NickTaken += Client_NickTaken; client.Connect(); } }