示例#1
0
 public void Switch(Channel newChannel)
 {
     name = newChannel.Name;
 }
        public TwitchChatBot(string ip, int port)
        {
            InitializeComponent();
            try
            {
                Channel channelBase = new Channel("lezrecbot");
                TwitchChatBot.ChannelIn = channelBase;
                TwitchChatBot.ChannelIn.Switch(new Channel("lezrecbot"));
                client = new TcpClient(ip, port);
                writer = new StreamWriter(client.GetStream());
                reader = new StreamReader(client.GetStream());
                

                string password = File.ReadAllText("password.txt");


                writer.WriteLine("PASS " + password + Environment.NewLine
                    + "NICK lezrecbot" + Environment.NewLine
                    + "USER lezrecbot" + " 8 * :lezrecbot");
                writer.Flush();

                logger = new MessageLogger(true);
                list = new CommandList();
                initialized = true;
            }
            catch (Exception exc)
            {
                label1.Text += $"\r\r{exc.ToString()}";
                label1.Text += $"\r\nConstructor Error!";
                initialized = false;
            }
            finally
            {
                
            }
        }
 public void Reconnect(Channel channel)
 {
     if (initialized)
     {
         InputCount++;
         TwitchChatBot.ChannelIn = channel;
         ChannelIn.ConnectTo();
         
     }
     else
     {
         label1.Text += $"\r\nSomething happened. Now I can't connect! :(";
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     ChannelIn = new Channel(textBox1.Text);
     MessageWithUserList.desigName = ChannelIn.Name;
     Reconnect(ChannelIn);
     LezrecBotSendChatMessage("Kappa This is a LezrecBoi attack you are now going to lose followers! Kappa");
     
 }
 public BackgroundPacket(Channel ch, User usr)
 {
     channel = ch;
     user = usr;
 }