当前位置: 首页>>代码示例>>C#>>正文


C# Bot.Say方法代码示例

本文整理汇总了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>&raquo; I have not disconnected since startup.</b>");
     else
         bot.Say(ns, String.Format("<b>&raquo; I have disconnected {0} time{1} since startup.</b>", Program.Disconnects, Program.Disconnects == 1 ? "" : "s"));
 }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:7,代码来源:Disconnects.cs

示例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>&raquo; 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);
            }
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:29,代码来源:Say.cs

示例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>&raquo; Network usage stats reset.</b>");
                    return;
                }
                else
                {
                    bot.Say(ns, "<b>&raquo; You don't have permission to do that.</b>");
                    return;
                }
            }

            String output = "<bcode>";

            bool verbose = (args.Length >= 2 && args[1] == "verbose");

            output += String.Format("&raquo; Data sent : {0}\n", Tools.FormatBytes(Program.bytes_sent, verbose));
            output += String.Format("&raquo; Data recv : {0}\n", Tools.FormatBytes(Program.bytes_received, verbose));
            output += String.Format("&raquo; Packets   : OUT: {0}\t\tIN: {1}\n", Program.packets_out, Program.packets_in);
            output += String.Format("&raquo; Queues    : OUT: {0}\t\tIN: {1}\n", bot.QueuedOut, bot.QueuedIn);
            output += String.Format("&raquo; Disconnects: {0}\n", Program.Disconnects);
            output += "</bcode>";

            bot.Say(ns, output);
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:33,代码来源:NetInfo.cs

示例4: cmd_reload

        public static void cmd_reload(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
        {
            bot.Say(ns, "<b>&raquo; Reloading extensions...</b>");
            ulong start = Bot.EpochTimestampMS;

            Events.ClearExternalEvents();
            Bot.Extensions.Load();

            bot.Say(ns, "<b>&raquo; Done!</b> Took " + Tools.FormatTime((ulong)(Bot.EpochTimestampMS - start) / 1000));
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:10,代码来源:Reload.cs

示例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>&raquo; 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>&raquo; Failed to join {0} [{1}]</b>", Tools.FormatChat(packet.Parameter), packet.Arguments["e"]));

                        CommandChannels["join"].RemoveAt(0);
                    }
                }
            }
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:55,代码来源:Join.cs

示例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>&raquo; Usage:</b><br/>{0}ai on/off<br/>{0}ai enable/disable #channel", " &middot; " + 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>&raquo; 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>&raquo; Invalid channel name! Channel names start with #</b>");
                        return;
                    }
                    else if (blacklist.Contains(args[2].ToLower()))
                    {
                        bot.Say(ns, "<b>&raquo; 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>&raquo; Channel {0} has been added to the whitelist.</b>", args[2]));
                        }
                        else bot.Say(ns, "<b>&raquo; 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>&raquo; Channel {0} has been removed from the whitelist.</b>", args[2]));
                        }
                        else bot.Say(ns, "<b>&raquo; That channel is not in the whitelist!</b>");
                    }
                }
                else bot.Say(ns, helpmsg);
            }
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:55,代码来源:AI.cs

示例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>&raquo; The bot is already up to date!</b>");
            else if (utd == "ERR")
                bot.Say(ns, "<b>&raquo; Unable to check at this time. You can also <a href=\"http://j.mp/15ikMg1\">check manually.</a></b>");
            else
                bot.Say(ns, "<b>&raquo; There's a new version available! <a href=\"http://j.mp/15ikMg1\">" + utd + "</a></b>");
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:11,代码来源:Update.cs

示例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>&raquo; Usage:</b> {0}debug on/off", bot.Config.Trigger));
     }
     else
     {
         String cmd = args[1];
         Program.Debug = cmd == "on";
         bot.Say(ns, String.Format("<b>&raquo; Debug mode has been {0}.</b>", Program.Debug ? "enabled" : "disabled"));
     }
 }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:13,代码来源:Debug.cs

示例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);
                });
        }
开发者ID:osbornm,项目名称:Jabbot,代码行数:15,代码来源:Members.cs

示例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>&raquo; 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);
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:34,代码来源:Cycle.cs

示例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>&raquo; I am currently residing in {0} channel{1}:</b><br/>", chans.Count, chans.Count == 1 ? "" : "s");

                output += String.Format("<b> &middot; [</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);
            }
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:26,代码来源:Channels.cs

示例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>&raquo; Usage:</b> {0}part #channel", bot.Config.Trigger));
            }
            else
            {
                if (!args[1].StartsWith("#"))
                {
                    bot.Say(ns, "<b>&raquo; Invalid channel!</b> Channels should start with a #");
                    return;
                }

                c = args[1];
            }

            lock (CommandChannels["part"])
            {
                CommandChannels["part"].Add(ns);
            }

            bot.Part(c);
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:27,代码来源:Part.cs

示例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>&raquo; 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);
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:8,代码来源:System.cs

示例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>&raquo; 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>&raquo; Invalid property!</b> Valid properties are title and topic.");
                    return;
                }

                lock (CommandChannels["set"])
                {
                    CommandChannels["set"].Add(ns);

                    bot.Send(dAmnPackets.Set(chan, prop, body));
                }
            }
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:44,代码来源:Set.cs

示例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>&raquo; Usage:</b><br/>{0}colors on/off<br/>{0}colors username/message #colorcode", " &middot; " + 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>&raquo; 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>&raquo; Invalid color code! Use HTML color codes.</b>");
                        return;
                    }

                    Config.UsernameColor = args[2].Substring(1);
                    Save();
                    bot.Say(ns, String.Format("<b>&raquo; 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>&raquo; Invalid color code! Use HTML color codes.</b>");
                        return;
                    }

                    Config.MessageColor = args[2].Substring(1);
                    Save();
                    bot.Say(ns, String.Format("<b>&raquo; Message color has been set to {0}.</b>", args[2]));
                }
                else bot.Say(ns, helpmsg);
            }
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:43,代码来源:Colors.cs


注:本文中的Bot.Say方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。