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


C# Bot.Leave方法代码示例

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


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

示例1: BotHostModule

        public BotHostModule(Bot bot)
            : base("bot")
        {
            _bot = bot;

            Get["/start"] = _ =>
            {
                try
                {
                    StartBot();
                    return "Bot Started";
                }
                catch (Exception e)
                {
                    return e.Message;
                }
            };

            Get["/stop"] = _ =>
            {
                try
                {
                    ShutDownBot();
                    return "Bot Shut Down";
                }
                catch (Exception e)
                {
                    return e.Message;
                }
            };

            // This is for ensuring that the process doesn't die permanently --
            // We create a task with MomentApp (TBD whether we will use this permanently
            Get["/keepalive"] = _ =>
            {
                ScheduleKeepAlive(Request.Url.ToString());
                return "OK";
            };

            Post["/launch"] = _ =>
            {
                //TODO: verify there is an auth token

                return "";
            };

            Post["/join"] = _ =>
                                {
                                    _bot.Join(Request.Form.Room);
                                    return Response.AsRedirect("/Rooms");
                                };

            Get["/leave"] = _ =>
                                {
                                    _bot.Leave(Request.Query.Room);
                                    return Response.AsRedirect("/Rooms");
                                };
        }
开发者ID:Raion,项目名称:jibbr,代码行数:58,代码来源:BotHostModule.cs

示例2: BotHostModule

        public BotHostModule(Bot bot, SprocketManager sprockets, IEnumerable<ISprocketInitializer> sprocketInitializers)
            : base("bot")
        {
            _bot = bot;
            _sprockets = sprockets;
            _sprocketInitializers = sprocketInitializers;

            Get["/start"] = _ =>
            {
                try
                {
                    StartBot();

                    return "Bot Started";
                }
                catch (Exception e)
                {
                    return e.Message;
                }
            };

            Get["/stop"] = _ =>
            {
                try
                {
                    ShutDownBot();
                    return "Bot Shut Down";
                }
                catch (Exception e)
                {
                    return e.Message;
                }
            };

            // This is for ensuring that the process doesn't die permanently --
            // We create a task with MomentApp (TBD whether we will use this permanently
            Get["/keepalive"] = _ =>
            {
                ScheduleKeepAlive(Request.Url.ToString());
                return "OK";
            };

            Get["/launch"] = _ =>
            {
                //TODO: verify there is an auth token
                LoadCoffeeScript();
                return "";
            };

            Post["/join"] = _ =>
                                {
                                    _bot.Join(Request.Form.Room);
                                    return Response.AsRedirect("/Rooms");
                                };

            Get["/leave"] = _ =>
                                {
                                    _bot.Leave(Request.Query.Room);
                                    return Response.AsRedirect("/Rooms");
                                };
            Post["/send/{room}"] = _ =>
                                       {
                                           _bot.Say(Request.Form.Message, _.Room);
                                           return Response.AsRedirect("/");
                                       };

            Post["/attach"] = _ =>
                                  {
                                      AttachScript(Request.Form.script);
                                      return Response.AsRedirect("/");
                                  };

            Post["/disable/{sprocket}"] = _ =>
                                              {
                                                  var sprocket = sprockets[_.Sprocket];
                                                  _bot.DisableSprocket(sprocket);
                                                  return Response.AsRedirect("/");
                                              };

            Post["/enable/{sprocket}"] = _ =>
                                              {
                                                  var sprocket = sprockets[_.Sprocket];
                                                  _bot.EnableSprocket(sprocket);
                                                  return Response.AsRedirect("/");
                                              };
        }
开发者ID:brooklynDev,项目名称:jibbr,代码行数:86,代码来源:BotHostModule.cs


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