本文整理汇总了C#中Meebey.SmartIrc4net.IrcClient类的典型用法代码示例。如果您正苦于以下问题:C# IrcClient类的具体用法?C# IrcClient怎么用?C# IrcClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IrcClient类属于Meebey.SmartIrc4net命名空间,在下文中一共展示了IrcClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: getQuiet
public static void getQuiet(string[] args, string Channel, string Nick, IrcClient irc)
{
if (args.Length > 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "getQuiet [#channel]", Nick)); }
else
{
string quietChan = Channel;
bool chanCheck = false;
if (args.Length == 2) { quietChan = args[1]; }
if (quietChan.StartsWith("#"))
{
MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
command.CommandText = "SELECT Channel,Quiet FROM channels WHERE Channel='" + quietChan.ToLower() + "'";
try { Program.GlobalVar.conn.Open(); }
catch (Exception e) { Console.WriteLine(e.Message); }
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
if (reader["Channel"].ToString() == quietChan.ToLower())
{
if (Convert.ToInt32(reader["Quiet"]) == 0) { irc.SendMessage(SendType.Notice, Nick, String.Format("{0} is currently set to Not Quiet", Channel)); }
else { irc.SendMessage(SendType.Notice, Nick, String.Format("{0} is currently set to Quiet", Channel)); }
chanCheck = true;
}
}
Program.GlobalVar.conn.Close();
if (chanCheck == false) { irc.SendMessage(SendType.Notice, Nick, String.Format("I don't have data on that channel sir")); }
}
else { irc.SendMessage(SendType.Message, Channel, String.Format("Please input a valid channel name sir")); }
}
}
开发者ID:jefe323,项目名称:Botler,代码行数:31,代码来源:chantoggles.cs
示例2: command
//https://developers.google.com/youtube/2.0/developers_guide_dotnet
public static void command(string[] args, string Channel, string Nick, IrcClient irc)
{
if (args.Length == 1)
{
irc.SendMessage(SendType.Message, Channel, string.Format("{0}, Usage: $youtube [flag] <search term(s)>", Nick));
}
else
{
string strVideo = string.Empty;
string flag = string.Empty;
if (args[1].StartsWith("+"))
{
for (int i = 2; i < args.Length; i++)
{
strVideo += args[i] + ' ';
}
strVideo = strVideo.TrimEnd();
flag = args[1];
}
else
{
foreach (string ss in args)
strVideo += ss + ' ';
strVideo = strVideo.Substring(args[0].Length + 1);
strVideo = strVideo.TrimEnd(' ');
}
string videoOutput = YoutubeOutput(strVideo, flag);
irc.SendMessage(SendType.Message, Channel, string.Format("{0}: {1}", Nick, videoOutput));
}
}
开发者ID:jefe323,项目名称:Botler,代码行数:31,代码来源:Youtube.cs
示例3: RelayConsole
public RelayConsole(RadegastInstance instance)
: base(instance)
{
InitializeComponent();
Disposed += new EventHandler(RelayConsole_Disposed);
textPrinter = new RichTextBoxPrinter(rtbChatText);
irc = new IrcClient();
irc.SendDelay = 200;
irc.AutoReconnect = true;
irc.CtcpVersion = Properties.Resources.RadegastTitle;
irc.Encoding = Encoding.UTF8;
TC.OnTabAdded += new TabsConsole.TabCallback(TC_OnTabAdded);
TC.OnTabRemoved += new TabsConsole.TabCallback(TC_OnTabRemoved);
irc.OnError += new ErrorEventHandler(irc_OnError);
irc.OnRawMessage += new IrcEventHandler(irc_OnRawMessage);
irc.OnChannelMessage += new IrcEventHandler(irc_OnChannelMessage);
irc.OnConnected += new EventHandler(irc_OnConnected);
irc.OnDisconnected += new EventHandler(irc_OnDisconnected);
client.Self.IM += new EventHandler<InstantMessageEventArgs>(Self_IM);
RefreshGroups();
}
开发者ID:TooheyPaneer,项目名称:radegast,代码行数:25,代码来源:RelayConsole.cs
示例4: getInstance
public static IrcClient getInstance()
{
if (instance == null)
instance = new IrcClient();
return instance;
}
开发者ID:undeclared,项目名称:nullbot,代码行数:7,代码来源:Client.cs
示例5: set
public static void set(string[] args, string Channel, string Nick, IrcClient irc)
{
DateTime tellTime = DateTime.Now;
string message = string.Empty;
if (args.Length == 1 || args.Length == 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "tell <nick> <message>", Nick)); }
else
{
foreach (string s in args)
message += s + " ";
message = message.Substring(args[0].Length + args[1].Length + 2);
message = message.TrimEnd(' ');
MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
Program.GlobalVar.conn.Open();
command.Connection = Program.GlobalVar.conn;
command.CommandText = "INSERT into tell VALUES(@to,@from,@message,@time)";
command.Prepare();
command.Parameters.AddWithValue("@to", args[1].ToLower());
command.Parameters.AddWithValue("@from", Nick);
command.Parameters.AddWithValue("@message", message);
command.Parameters.AddWithValue("@time", tellTime.ToString());
command.ExecuteNonQuery();
Program.GlobalVar.conn.Close();
try { Program.GlobalVar.tellList.Add(args[1].ToLower()); }
catch { }
Console.WriteLine("{0} has left a message for {1}", Nick, args[1]);
irc.SendMessage(SendType.Message, Channel, String.Format("I will pass that along sir"));
}
}
开发者ID:jefe323,项目名称:Botler,代码行数:35,代码来源:tell.cs
示例6: get
public static void get(string[] args, string Channel, string Nick, IrcClient irc)
{
DateTime time = DateTime.Now;
string message = string.Empty;
bool tellCheck = false;
MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
command.CommandText = "SELECT Nick_To,Nick_From,Message,Time FROM tell where Nick_To='" + Nick.ToLower() + "'";
try { Program.GlobalVar.conn.Open(); }
catch (Exception e) { Console.WriteLine(e.Message); }
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
if (reader["Nick_To"].ToString() == Nick.ToLower())
{
tellCheck = true;
//Compose output
TimeSpan elapsed = time.Subtract(DateTime.Parse(reader["Time"].ToString()));
message = String.Format("({0:%d} days, {1:%h} hours, {2:%m} minutes) Sent from {3} -- {4}", elapsed, elapsed, elapsed, reader["Nick_From"].ToString(), reader["Message"].ToString());
//send output
irc.SendMessage(SendType.Message, Nick, message);
try { Program.GlobalVar.tellList.Remove(Nick); }
catch { }
}
}
Program.GlobalVar.conn.Close();
command.CommandText = "DELETE FROM tell WHERE Nick_To='" + Nick.ToLower() + "'";
Program.GlobalVar.conn.Open();
command.ExecuteNonQuery();
Program.GlobalVar.conn.Close();
if (tellCheck == false) { irc.SendMessage(SendType.Message, Nick, String.Format("I don't have any messages for you sir")); }
}
开发者ID:jefe323,项目名称:Botler,代码行数:35,代码来源:tell.cs
示例7: command
public static void command(string trigger, string Channel, string Nick, IrcClient irc)
{
//first make sure the trigger exists
bool remCheck = false;
bool global = false;
bool lck = false;
MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
command.CommandText = "SELECT Trig,Channel,Nick,Time,lck FROM rem where Trig='" + trigger + "'";
try { Program.GlobalVar.conn.Open(); }
catch (Exception e) { Console.WriteLine(e.Message); }
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
if (reader["Trig"].ToString() == trigger && (reader["Channel"].ToString() == Channel.ToLower() || reader["channel"].ToString() == "global"))
{
remCheck = true;
if (reader["Channel"].ToString() == "global")
global = true;
if (Convert.ToInt32(reader["lck"]) == 1)
lck = true;
irc.SendMessage(SendType.Message, Channel, String.Format("{0} was set by {1} at {2} (G={3}/L={4})", trigger, reader["Nick"].ToString(), reader["Time"].ToString(), global, lck));
global = false;
lck = false;
}
}
Program.GlobalVar.conn.Close();
//get info
if (remCheck == false) { irc.SendMessage(SendType.Notice, Nick, String.Format("I don't have anything stored for {0} sir", trigger)); }
}
开发者ID:jefe323,项目名称:Botler,代码行数:29,代码来源:info.cs
示例8: change
public static void change(string[] args, string Channel, string Nick, IrcClient irc)
{
if (args.Length != 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "nick <new nick>", Nick)); }
{
irc.RfcNick(args[1]);
}
}
开发者ID:jefe323,项目名称:Botler,代码行数:7,代码来源:nick.cs
示例9: set
//addquote <name> <message>
public static void set(string[] args, string Channel, string Nick, IrcClient irc)
{
if (args.Length <= 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "addquote <nick> <message>", Nick)); }
else
{
MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
//rebuild message
string message = string.Empty;
foreach (string s in args)
message += s + " ";
message = message.Substring(args[0].Length + args[1].Length + 2);
message = message.TrimEnd(' ');
try
{
Program.GlobalVar.conn.Open();
command.Connection = Program.GlobalVar.conn;
command.CommandText = "INSERT into quote VALUES(@nick,@message)";
command.Prepare();
command.Parameters.AddWithValue("@nick", args[1]);
command.Parameters.AddWithValue("@message", message);
command.ExecuteNonQuery();
Program.GlobalVar.conn.Close();
irc.SendMessage(SendType.Message, Channel, String.Format("I have added the quote sir, I hope it is very embarrassing"));
}
catch (Exception e) { Botler.Utilities.TextFormatting.ConsoleERROR(e.Message + "\n"); }
}
}
开发者ID:jefe323,项目名称:Botler,代码行数:33,代码来源:quote.cs
示例10: SparkleListenerIrc
public SparkleListenerIrc(string server, string folder_identifier, NotificationServerType type)
: base(server, folder_identifier, type)
{
base.server = server;
// Try to get a uniqueish nickname
this.nick = SHA1 (DateTime.Now.ToString ("ffffff") + "sparkles");
// Most irc servers don't allow nicknames starting
// with a number, so prefix an alphabetic character
this.nick = "s" + this.nick.Substring (0, 7);
base.channels.Add ("#" + folder_identifier);
this.client = new IrcClient () {
PingTimeout = 180,
PingInterval = 90
};
this.client.OnConnected += delegate {
base.is_connecting = false;
OnConnected ();
};
this.client.OnDisconnected += delegate {
OnDisconnected ();
};
this.client.OnChannelMessage += delegate (object o, IrcEventArgs args) {
string message = args.Data.Message.Trim ();
string folder_id = args.Data.Channel.Substring (1); // remove the starting hash
OnRemoteChange (new SparkleAnnouncement (folder_id, message));
};
}
开发者ID:forkmerge,项目名称:SparkleShare,代码行数:34,代码来源:SparkleListenerIrc.cs
示例11: Ralph
public Ralph(String _channel,String _token,String _name)
{
this._token = "oauth:"+_token;
this._channel = _channel;
this._name = "AneleBot";
_client = new IrcClient()
{
Encoding = Encoding.UTF8,
ActiveChannelSyncing = true,
SendDelay = 5000,
AutoRejoin = true,
AutoRejoinOnKick = true,
AutoReconnect = true,
AutoRelogin = true,
AutoRetry = true,
AutoRetryLimit = 0
};
_client.OnChannelMessage+=onMessage;
_client.OnRawMessage += logMessage;
_handler = new RHandler(this);
DumberLogger.Log("Ralph: ralph got created");
}
开发者ID:HagenHeermann,项目名称:RalphInC-,代码行数:25,代码来源:Ralph.cs
示例12: command
public static void command(string[] args, string Channel, string Nick, IrcClient irc)
{
if (args.Length > 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "chanop [#channel]", Nick)); }
else
{
string opChan = Channel;
bool chanCheck = false;
if (args.Length == 2) { opChan = args[1]; }
if (opChan.StartsWith("#"))
{
MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
command.CommandText = "SELECT Channel,ChanOP FROM channels WHERE Channel='" + opChan.ToLower() + "'";
try { Program.GlobalVar.conn.Open(); }
catch (Exception e) { Console.WriteLine(e.Message); }
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
if (reader["Channel"].ToString() == opChan.ToLower())
{
irc.SendMessage(SendType.Message, Channel, String.Format("The Channel Operator for {0} is {1}", opChan, reader["ChanOP"].ToString()));
chanCheck = true;
}
}
Program.GlobalVar.conn.Close();
if (chanCheck == false) { irc.SendMessage(SendType.Message, Channel, String.Format("I don't have data for that channel sir")); }
}
else { irc.SendMessage(SendType.Message, Channel, String.Format("Please input a valid channel name sir")); }
}
}
开发者ID:jefe323,项目名称:Botler,代码行数:30,代码来源:chanop.cs
示例13: Connect
public void Connect()
{
IrcClient = new IrcClient();
IrcClient.OnConnected += OnConnected;
IrcClient.OnConnecting += OnConnecting;
IrcClient.OnDisconnected += OnDisconnected;
//IrcClient.OnReadLine += OnReadLine;
IrcClient.OnPing += OnPing;
IrcClient.OnRawMessage += OnRawMessage;
IrcClient.AutoRetry = Convert.ToBoolean(Connection.auto_retry);
IrcClient.AutoRetryDelay = Convert.ToInt32(Connection.auto_retry_delay);
IrcClient.AutoReconnect = Convert.ToBoolean(Connection.auto_reconnect);
IrcClient.AutoRelogin = Convert.ToBoolean(Connection.auto_relogin);
IrcClient.AutoRejoin = Convert.ToBoolean(Connection.auto_rejoin);
IrcClient.AutoRejoinOnKick = Convert.ToBoolean(Connection.auto_rejoin_on_kick);
IrcClient.AutoNickHandling = Convert.ToBoolean(Connection.auto_nick_handling);
try
{
IrcClient.Connect(Connection.hostname, Convert.ToInt32(Connection.port));
}
catch (Exception e)
{
Console.WriteLine("Failed to connect: " + e.Message);
}
}
开发者ID:soend,项目名称:Glucodyn,代码行数:27,代码来源:IdentityConnection.cs
示例14: set
//blacklist <nick> <host>
public static void set(string[] args, string Channel, string Nick, IrcClient irc)
{
if (args.Length != 3) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "blacklist <nick> <host>", Nick)); }
else
{
MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
try
{
Program.GlobalVar.conn.Open();
command.Connection = Program.GlobalVar.conn;
command.CommandText = "INSERT into blacklist VALUES(@nick,@host)";
command.Prepare();
command.Parameters.AddWithValue("@nick", args[1].ToLower());
command.Parameters.AddWithValue("@host", args[2]);
command.ExecuteNonQuery();
Program.GlobalVar.conn.Close();
irc.SendMessage(SendType.Message, Channel, String.Format("I have added {0}@{1} to the blacklist sir, we don't want naughty people using me", args[1].ToLower(), args[2]));
Console.WriteLine("{0} was added to the blacklist", args[1].ToLower());
}
catch (Exception e) { Botler.Utilities.TextFormatting.ConsoleERROR(e.Message + "\n"); }
}
}
开发者ID:jefe323,项目名称:Botler,代码行数:27,代码来源:blacklist.cs
示例15: ident
public static void ident(string[] args, string Channel, string Nick, IrcClient irc)
{
if (args.Length != 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "ident <password>", Nick)); }
{
irc.SendMessage(SendType.Message, "NickServ", String.Format("identify {0}", args[1]));
}
}
开发者ID:jefe323,项目名称:Botler,代码行数:7,代码来源:nick.cs
示例16: ClientInterface
public ClientInterface(IrcLoginCreds loginCreds, List<IrcComponent> auxComponents)
{
KillClient = false;
Client = new IrcClient();
Client.SendDelay = 200;
Client.ActiveChannelSyncing = true;
//Client.AutoRetry = true;
_loginCreds = loginCreds;
Client.CtcpVersion = "Pikatwo - Interactive chatbot with lifelike texture by zalzane.";
_authenticator = new Authenticator();
_components = auxComponents;
_components.Add(_authenticator);
_components.Add(new Reconnector());
foreach (var component in _components){
component.IrcInterface = this;
}
Client.OnChannelMessage += HandleCommands;
Client.OnQueryMessage += HandleCommands;
Client.OnRawMessage += ClientOnOnRawMessage;
_debugWriter = new StreamWriter("debugOut.txt", true);
_rawWriter = new StreamWriter("rawOut.txt", true);
}
开发者ID:bsamuels453,项目名称:Pikatwo,代码行数:27,代码来源:ClientInterface.cs
示例17: exit
public static void exit(string Channel, string nick, IrcClient irc)
{
irc.SendMessage(SendType.Message, Channel, String.Format("Goodbye cruel world..."));
Program.GlobalVar.active = false;
irc.Disconnect();
Program.Exit();
}
开发者ID:jefe323,项目名称:Botler,代码行数:7,代码来源:quit.cs
示例18: sendAll
public static void sendAll(string[] args, string Channel, string Nick, IrcClient irc)
{
if (args.Length == 1) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "broadcast <message>", Nick)); }
else
{
string msg = string.Empty;
foreach (string s in args)
msg += s + " ";
msg = msg.Substring(args[0].Length + args[1].Length + 2);
msg.TrimEnd(' ');
//white text on red background
if (args[1] == "emergency")
{
msg = Utilities.TextFormatting.Bold(((char)3 + "0,4" + msg + (char)3 + "0,4"));
}
//will add more later
MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
command.CommandText = "SELECT Channel FROM channels";
try { Program.GlobalVar.conn.Open(); }
catch (Exception e) { Console.WriteLine(e.Message); }
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
irc.SendMessage(SendType.Message, reader["Channel"].ToString(), msg);
}
Program.GlobalVar.conn.Close();
}
}
开发者ID:jefe323,项目名称:Botler,代码行数:30,代码来源:broadcast.cs
示例19: BackgroundWorkerThread
public BackgroundWorkerThread(string perryver, string nick, int wait)
{
//this.mw = mw;
this.perryver = perryver;
this.ourNick = nick;
this.waitTime = wait;
Random r = new Random(DateTime.Now.Millisecond);
string bleh = "";
bleh = nick;
if (bleh.Length > 6) bleh = bleh.Substring(0, 6);
else if (bleh == "") bleh = "ps";
ourNick = bleh + r.Next(9999).ToString();
client = new IrcClient();
client.Encoding = Encoding.UTF8;
client.OnChannelMessage += new IrcEventHandler(client_OnChannelMessage);
t = new Thread(new ThreadStart(ListenIRC));
t.Priority = ThreadPriority.Lowest;
t.IsBackground = true;
t.Start();
}
开发者ID:nuukcillo,项目名称:PerrySub,代码行数:25,代码来源:BackgroundWorkerThread.cs
示例20: SparkleListener
public SparkleListener(string server, string channel, string nick)
{
Server = server;
Channel = channel;
Nick = nick;
if (!Nick.Equals (""))
Nick = nick.Replace ("@", "_at_").Replace (".", "_dot_");
else
Nick = "anonymous";
// Keep the nick short
if (Nick.Length > 9)
Nick = Nick.Substring (0, 9);
// TODO: Remove these hardcoded values
Channel = "#sparkletest";
Server = "irc.gnome.org";
Client = new IrcClient () {
PingTimeout = 120,
SocketSendTimeout = 120,
SocketReceiveTimeout = 120,
AutoRetry = true,
AutoReconnect = true,
AutoRejoin = true
};
}
开发者ID:kristi,项目名称:SparkleShare,代码行数:28,代码来源:SparkleListener.cs
注:本文中的Meebey.SmartIrc4net.IrcClient类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论