本文整理汇总了C#中Bot.Say方法的典型用法代码示例。如果您正苦于以下问题:C# Bot.Say方法的具体用法?C# Bot.Say怎么用?C# Bot.Say使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bot
的用法示例。
在下文中一共展示了Bot.Say方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cmd_disconnects
public static void cmd_disconnects(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
if (Program.Disconnects == 0)
bot.Say(ns, "<b>» I have not disconnected since startup.</b>");
else
bot.Say(ns, String.Format("<b>» I have disconnected {0} time{1} since startup.</b>", Program.Disconnects, Program.Disconnects == 1 ? "" : "s"));
}
示例2: cmd_say
public static void cmd_say(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
if (args.Length < 2)
{
bot.Say(ns, String.Format("<b>» Usage:</b> {0}say <i>[#channel]</i> <i>msg</i>", bot.Config.Trigger));
}
else
{
String chan, mesg;
if (!args[1].StartsWith("#"))
{
chan = ns;
mesg = msg.Substring(4);
}
else
{
chan = args[1];
mesg = msg.Substring(5 + args[1].Length);
}
lock (CommandChannels["send"])
{
CommandChannels["send"].Add(ns);
}
bot.Say(chan, mesg);
}
}
示例3: cmd_netinfo
public static void cmd_netinfo(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
if (args.Length >= 2 && args[1] == "reset")
{
if (Users.GetPrivs(from.ToLower()) >= (int)Privs.Operators)
{
Program.bytes_sent = 0;
Program.bytes_received = 0;
Program.packets_in = 0;
Program.packets_out = 0;
bot.Say(ns, "<b>» Network usage stats reset.</b>");
return;
}
else
{
bot.Say(ns, "<b>» You don't have permission to do that.</b>");
return;
}
}
String output = "<bcode>";
bool verbose = (args.Length >= 2 && args[1] == "verbose");
output += String.Format("» Data sent : {0}\n", Tools.FormatBytes(Program.bytes_sent, verbose));
output += String.Format("» Data recv : {0}\n", Tools.FormatBytes(Program.bytes_received, verbose));
output += String.Format("» Packets : OUT: {0}\t\tIN: {1}\n", Program.packets_out, Program.packets_in);
output += String.Format("» Queues : OUT: {0}\t\tIN: {1}\n", bot.QueuedOut, bot.QueuedIn);
output += String.Format("» Disconnects: {0}\n", Program.Disconnects);
output += "</bcode>";
bot.Say(ns, output);
}
示例4: cmd_reload
public static void cmd_reload(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
bot.Say(ns, "<b>» Reloading extensions...</b>");
ulong start = Bot.EpochTimestampMS;
Events.ClearExternalEvents();
Bot.Extensions.Load();
bot.Say(ns, "<b>» Done!</b> Took " + Tools.FormatTime((ulong)(Bot.EpochTimestampMS - start) / 1000));
}
示例5: evt_join
public static void evt_join(Bot bot, dAmnPacket packet)
{
if (BDS.syncing && packet.Parameter.StartsWith("pchat:") && packet.Parameter.ToLower().Contains(BDS.syncwith))
{
BDS.syncwatch = Stopwatch.StartNew();
bot.NPSay(packet.Parameter, "BDS:SYNC:BEGIN");
return;
}
// Don't display DataShare messages.
if (Program.NoDisplay.Contains(Tools.FormatNamespace(packet.Parameter.ToLower(), Types.NamespaceFormat.Channel))) return;
if (packet.Arguments["e"] == "ok")
{
ConIO.Write(String.Format("** Joined [{0}]", packet.Arguments["e"]), Tools.FormatChat(packet.Parameter));
// Initialize channel data
lock (ChannelData)
{
if (!ChannelData.ContainsKey(packet.Parameter.ToLower()))
{
ChannelData.Add(packet.Parameter.ToLower(), new Types.ChatData());
ChannelData[packet.Parameter.ToLower()].Name = packet.Parameter;
}
}
lock (CommandChannels["join"])
{
if (CommandChannels["join"].Count != 0)
{
String chan = CommandChannels["join"][0];
bot.Say(chan, String.Format("<b>» Joined {0} [ok]</b>", Tools.FormatChat(packet.Parameter)));
CommandChannels["join"].RemoveAt(0);
}
}
}
else
{
ConIO.Write(String.Format("** Failed to join [{0}]", packet.Arguments["e"]), Tools.FormatChat(packet.Parameter));
lock (CommandChannels["join"])
{
if (CommandChannels["join"].Count != 0)
{
String chan = CommandChannels["join"][0];
bot.Say(chan, String.Format("<b>» Failed to join {0} [{1}]</b>", Tools.FormatChat(packet.Parameter), packet.Arguments["e"]));
CommandChannels["join"].RemoveAt(0);
}
}
}
}
示例6: cmd_ai
public static void cmd_ai(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
String helpmsg = String.Format("<b>» Usage:</b><br/>{0}ai on/off<br/>{0}ai enable/disable #channel", " · " + bot.Config.Trigger);
if (args.Length == 1)
bot.Say(ns, helpmsg);
else
{
String arg = args[1];
if (arg == "on" || arg == "off")
{
Config.Enabled = arg == "on";
Save();
bot.Say(ns, String.Format("<b>» AI has been {0}.</b>", Config.Enabled ? "enabled" : "disabled"));
}
else if ((arg == "enable" || arg == "disable") && args.Length == 3)
{
if (!args[2].StartsWith("#"))
{
bot.Say(ns, "<b>» Invalid channel name! Channel names start with #</b>");
return;
}
else if (blacklist.Contains(args[2].ToLower()))
{
bot.Say(ns, "<b>» AI is forbidden in channel:</b> " + args[2]);
return;
}
String chan = Tools.FormatChat(args[2]).ToLower();
if (arg == "enable")
{
if (!Config.WhiteList.Contains(chan))
{
Config.WhiteList.Add(chan);
Save();
bot.Say(ns, String.Format("<b>» Channel {0} has been added to the whitelist.</b>", args[2]));
}
else bot.Say(ns, "<b>» That channel is already in the whitelist!</b>");
}
else
{
if (Config.WhiteList.Contains(chan))
{
Config.WhiteList.Remove(chan);
Save();
bot.Say(ns, String.Format("<b>» Channel {0} has been removed from the whitelist.</b>", args[2]));
}
else bot.Say(ns, "<b>» That channel is not in the whitelist!</b>");
}
}
else bot.Say(ns, helpmsg);
}
}
示例7: cmd_update
public static void cmd_update(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
String utd = Tools.UpToDate(Program.Version);
if (utd == "OK")
bot.Say(ns, "<b>» The bot is already up to date!</b>");
else if (utd == "ERR")
bot.Say(ns, "<b>» Unable to check at this time. You can also <a href=\"http://j.mp/15ikMg1\">check manually.</a></b>");
else
bot.Say(ns, "<b>» There's a new version available! <a href=\"http://j.mp/15ikMg1\">" + utd + "</a></b>");
}
示例8: cmd_debug
public static void cmd_debug(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
if (args.Length < 2)
{
bot.Say(ns, String.Format("<b>» Usage:</b> {0}debug on/off", bot.Config.Trigger));
}
else
{
String cmd = args[1];
Program.Debug = cmd == "on";
bot.Say(ns, String.Format("<b>» Debug mode has been {0}.</b>", Program.Debug ? "enabled" : "disabled"));
}
}
示例9: ProcessMatch
protected override void ProcessMatch(System.Text.RegularExpressions.Match match, Models.ChatMessage message, Bot bot)
{
var client = new NGitHub.GitHubClient();
var org = new NGitHub.Services.OrganizationService(client);
org.GetMembersAsync("NuGet",
members => {
bot.Say(string.Format("@{0}, Here are the people listed on github as part of the NuGet team. {1}. Why not get involved yourself? http://docs.nuget.org/docs/contribute/contributing-to-nuget",
message.FromUser, String.Join(", ", members.Select(m => String.Format("{0} ({1})", m.Name, m.Login)))), message.Room);
},
e =>
{
bot.Say(String.Format("I'm affriad I can't do that {0}. {1}", message.FromUser, e.ToString()), message.Room);
});
}
示例10: cmd_cycle
public static void cmd_cycle(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
var chan = "";
if (args.Length > 1 && args[1].StartsWith("#"))
{
chan = args[1];
}
else
{
chan = ns;
}
String cpns = Tools.FormatNamespace(chan, Types.NamespaceFormat.Packet).ToLower();
if (!Core.ChannelData.ContainsKey(cpns))
{
bot.Say(ns, "<b>» It doesn't look like I'm in that channel.</b>");
return;
}
lock (CommandChannels["part"])
{
CommandChannels["part"].Add(ns);
}
lock (CommandChannels["join"])
{
CommandChannels["join"].Add(ns);
}
bot.Part(cpns);
bot.Join(cpns);
}
示例11: cmd_channels
public static void cmd_channels(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
String output = String.Empty;
List<String> chans = new List<String>();
try
{
foreach (var cd in Core.ChannelData.Values)
if (cd.Name != "chat:DataShare" && !cd.Name.StartsWith("pchat") && !cd.Name.StartsWith("login"))
chans.Add(Tools.FormatNamespace(cd.Name, Types.NamespaceFormat.Channel));
chans.Sort();
output += String.Format("<b>» I am currently residing in {0} channel{1}:</b><br/>", chans.Count, chans.Count == 1 ? "" : "s");
output += String.Format("<b> · [</b>{0}<b>]</b>", String.Join("<b>]</b>, <b>[</b>", chans));
bot.Act(ns, output);
}
catch (Exception Ex)
{
if (Program.Debug)
bot.Say(ns, "Error: " + Ex.Message);
}
}
示例12: cmd_part
public static void cmd_part(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
var c = ns;
if (args.Length != 2)
{
// Ignore this for now.
//bot.Say(ns, String.Format("<b>» Usage:</b> {0}part #channel", bot.Config.Trigger));
}
else
{
if (!args[1].StartsWith("#"))
{
bot.Say(ns, "<b>» Invalid channel!</b> Channels should start with a #");
return;
}
c = args[1];
}
lock (CommandChannels["part"])
{
CommandChannels["part"].Add(ns);
}
bot.Part(c);
}
示例13: cmd_system
public static void cmd_system(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
String output = String.Empty;
output += String.Format("<b>» System:</b> {0}. <b>Architecture:</b> {1}bit. <b>CLR Version:</b> {2}<br/>", Program.OS, Environment.Is64BitOperatingSystem ? 64 : 32, Environment.Version.ToString());
bot.Say(ns, output);
}
示例14: cmd_set
public static void cmd_set(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
String helpmsg = String.Format("<b>» Usage:</b> {0}set <i>[#channel]</i> [title|topic] [content]", bot.Config.Trigger);
if (args.Length < 2)
{
bot.Say(ns, helpmsg);
}
else
{
String chan, prop, body;
if (!args[1].StartsWith("#"))
{
chan = ns.ToLower(); ;
prop = args[1];
body = msg.Substring(prop.Length + 4);
}
else if (args.Length >= 3)
{
chan = Tools.FormatChat(args[1]).ToLower();
prop = args[2];
body = msg.Substring(prop.Length + args[1].Length + 5);
}
else
{
bot.Say(ns, helpmsg);
return;
}
if (prop != "title" && prop != "topic")
{
bot.Say(ns, "<b>» Invalid property!</b> Valid properties are title and topic.");
return;
}
lock (CommandChannels["set"])
{
CommandChannels["set"].Add(ns);
bot.Send(dAmnPackets.Set(chan, prop, body));
}
}
}
示例15: cmd_colors
public static void cmd_colors(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
String helpmsg = String.Format("<b>» Usage:</b><br/>{0}colors on/off<br/>{0}colors username/message #colorcode", " · " + bot.Config.Trigger);
if (args.Length == 1)
bot.Say(ns, helpmsg);
else
{
String arg = args[1];
if (arg == "on" || arg == "off")
{
Config.Enabled = arg == "on";
Save();
bot.Say(ns, String.Format("<b>» Colors have been {0}.</b>", Config.Enabled ? "enabled" : "disabled"));
}
else if (arg == "username" && args.Length == 3)
{
if (!args[2].StartsWith("#") || args[2].Length != 7)
{
bot.Say(ns, "<b>» Invalid color code! Use HTML color codes.</b>");
return;
}
Config.UsernameColor = args[2].Substring(1);
Save();
bot.Say(ns, String.Format("<b>» Username color has been set to {0}.</b>", args[2]));
}
else if (arg == "message" && args.Length == 3)
{
if (!args[2].StartsWith("#") || args[2].Length != 7)
{
bot.Say(ns, "<b>» Invalid color code! Use HTML color codes.</b>");
return;
}
Config.MessageColor = args[2].Substring(1);
Save();
bot.Say(ns, String.Format("<b>» Message color has been set to {0}.</b>", args[2]));
}
else bot.Say(ns, helpmsg);
}
}