本文整理汇总了C#中Meebey.SmartIrc4net.IrcClient.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# IrcClient.SendMessage方法的具体用法?C# IrcClient.SendMessage怎么用?C# IrcClient.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Meebey.SmartIrc4net.IrcClient
的用法示例。
在下文中一共展示了IrcClient.SendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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));
}
}
示例2: 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"); }
}
}
示例3: 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")); }
}
}
示例4: 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")); }
}
示例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"));
}
}
示例6: 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)); }
}
示例7: 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"); }
}
}
示例8: 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();
}
}
示例9: 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")); }
}
}
示例10: 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]));
}
}
示例11: ghost
public static void ghost(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 + "ghost", Nick)); }
else
{
irc.SendMessage(SendType.Message, "NickServ", String.Format("ghost {0}, {1}", Program.GlobalVar.bot_nick, Program.GlobalVar.bot_ident));
irc.SendMessage(SendType.Message, Channel, String.Format("The imposter has been killed sir"));
}
}
示例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: $brainfuck <brainfuck program text>", Nick));
}
else
{
string output = bfOutput(args[1]);
irc.SendMessage(SendType.Message, Channel, string.Format("{0}, {1}", Nick, output));
}
}
示例13: 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: $deadfly <adf.ly link>", Nick));
}
else
{
string output = expandOutput(args[1]);
irc.SendMessage(SendType.Message, Channel, String.Format("{0}, {1}", Nick, output));
}
}
示例14: command
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: $twitter <user>", Nick));
}
else
{
string output = twitterOutput(args[1]);
irc.SendMessage(SendType.Message, Channel, string.Format("{0}, {1}", Nick, output));
}
}
示例15: send
public static void send(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 + "say <message>", Nick)); }
else
{
string str = string.Empty;
foreach (string s in args)
str += s + " ";
str = str.Substring(args[0].Length + 1);
irc.SendMessage(SendType.Message, Channel, str);
}
}