rendered paste bodyusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Meebey.SmartIrc4net;
using System.Threading;
namespace IRCBotGUI
{
public partial class IRCBotGUI : Form
{
private Thread _connect;
private IrcConnection irc = new IrcConnection();
private string server = "irc.freenode.com";
private int port = 6667;
private string channel = "#mybot";
public IRCBotGUI()
{
InitializeComponent();
}
public void Connect()
{
irc.Connect(server, port);
irc.WriteLine(Rfc2812.Nick("StaulkorBot"), Priority.Critical);
irc.WriteLine(Rfc2812.User("StaulkorBot", 0, "StaulkorBot"), Priority.Critical);
irc.WriteLine(Rfc2812.Join(channel));
irc.Listen();
}
private void buttonConnect_Click(object sender, EventArgs e)
{
_connect = new Thread(new ThreadStart(Connect));
buttonConnect.Enabled = false;
buttonDisconnect.Enabled = true;
}
private void buttonDisconnect_Click(object sender, EventArgs e)
{
irc.Disconnect();
}
}
}