Advertisement
Guest User

ChatForm

a guest
Jul 24th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace MyTwitchChat
  12. {
  13. public partial class Form1 : Form
  14. {
  15. private string username;
  16. private string password;
  17.  
  18. bool joined;
  19.  
  20. IRCClient ircClient;
  21. public Form1()
  22. {
  23. InitializeComponent();
  24.  
  25. }
  26.  
  27. private void button1_Click(object sender, EventArgs e)
  28. {
  29. username = userNameTB.Text;
  30. password = TokenBox.Text;
  31. ircClient = new IRCClient("irc.chat.twitch.tv", 6667, username, password);
  32. ircClient.joinChannel("deadlycursed");
  33.  
  34. timer1.Start();
  35.  
  36. }
  37.  
  38. private void timer1_Tick(object sender, EventArgs e)
  39. {
  40.  
  41.  
  42. if (ircClient.tcpClient.Available > 0 )
  43. {
  44.  
  45. string message = ircClient.inputStream.ReadLine();
  46.  
  47. ChatBox.Items.Add(message);
  48. if (message.Contains("!Hallo"))
  49. ircClient.sendChatMessage("Hi!");
  50. }
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement