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


C# Bot.Kick方法代码示例

本文整理汇总了C#中Bot.Kick方法的典型用法代码示例。如果您正苦于以下问题:C# Bot.Kick方法的具体用法?C# Bot.Kick怎么用?C# Bot.Kick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bot的用法示例。


在下文中一共展示了Bot.Kick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: cmd_kick

        public static void cmd_kick(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
        {
            String helpmsg = String.Format("<b>&raquo; Usage:</b> {0}kick <i>[#channel]</i> username <i>[reason]</i>", bot.Config.Trigger);

            if (args.Length < 2)
            {
                bot.Say(ns, helpmsg);
            }
            else
            {
                String chan, who, reason;

                if (!args[1].StartsWith("#"))
                {
                    chan = ns;
                    who = args[1];
                    reason = (args.Length >= 3 ? ": " + msg.Substring(6 + who.Length) : "");
                }
                else if (args.Length >= 3)
                {
                    chan = args[1];
                    who = args[2];
                    reason = (args.Length >= 4 ? ": " + msg.Substring(7 + who.Length + chan.Length) : "");
                }
                else
                {
                    bot.Say(ns, helpmsg);
                    return;
                }

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

                bot.Kick(chan, who, "<b>" + from + "</b>" + reason);
            }
        }
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:38,代码来源:Kick.cs

示例2: ParseBDS


//.........这里部分代码省略.........

                        String[] data = input.Split(',');

                        // Invalid data
                        if (data.Length < 6 || !data[3].Contains("/"))
                            return;

                        String[] versions = data[3].Split('/');
                        String botver = versions[0];
                        String hash = data[4];
                        String trig = data[5];
                        double bdsver = 0.0;

                        // trigger contains a comma?
                        if (data.Length > 6)
                        {
                            trig = String.Empty;
                            for (int b = 6; b < data.Length; b++)
                            {
                                if (b >= data.Length - 1)
                                    trig += data[b];
                                else
                                    trig += data[b] + ",";
                            }
                        }

                        if (!Double.TryParse(versions[1], out bdsver))
                            bdsver = 0.2;

                        Types.BotInfo bot_info = new Types.BotInfo(from, data[1], data[2], botver, trig, bdsver, Bot.EpochTimestamp);

                        String hashkey = Tools.md5((trig + data[0] + from).ToLower().Replace(" ", "")).ToLower();

                        ClearKickTimers(from);

                        if (hashkey != hash)
                        {
                            // Invalid hash supplied
                            // For now, we ignore this. Though I'd like to see policebots send and error like:
                            //  BDS:BOTCHECK:ERROR:INVALID_RESPONSE_HASH

                            // Police bot stuff.
                            if ((ns == "chat:DSGateway" || ns == "chat:DataShare") && IsPoliceBot(username, ns))
                            {
                                if (ns == "chat:DSGateway")
                                    bot.NPSay(ns, "BDS:BOTCHECK:DENIED:" + from + ",Invalid BDS:BOTCHECK");

                                bot.Kick(ns, from, "No response to or invalid BDS:BOTCHECK. If you are not a bot, please do not join this room. Thanks.");
                                bot.Promote("chat:DataShare", from, "BrokenBots");

                                if (!Kicks.ContainsKey(from))
                                    Kicks.Add(from, new KickInfo());

                                Kicks[from].Kick();

                                if (Kicks[from].Count >= 3)
                                {
                                    bot.Ban(ns, from);
                                    var t = new Timer(5000);
                                    t.Elapsed += delegate { bot.UnBan(ns, from); };
                                    t.Start();
                                }
                            }

                            if (Program.Debug)
                                ConIO.Warning("BDS", "Invalid hash for bot: " + from);
开发者ID:DivinityArcane,项目名称:lulzBot,代码行数:67,代码来源:BDS.cs


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