本文整理汇总了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");
};
}
示例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("/");
};
}