本文整理匯總了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("/");
};
}