SecondBot/Core/Commands/Home.cs
2021-03-25 10:35:06 +00:00

33 lines
1,009 B
C#

using BetterSecondBot.bottypes;
using BetterSecondBot.Static;
using EmbedIO;
using EmbedIO.Routing;
using EmbedIO.WebApi;
using System;
using System.Collections.Generic;
using System.Text;
using OpenMetaverse;
using Newtonsoft.Json;
using BetterSecondBotShared.Static;
namespace BetterSecondBot.HttpService
{
public class HTTP_Home : WebApiControllerWithTokens
{
public HTTP_Home(SecondBot mainbot, TokenStorage setuptokens) : base(mainbot, setuptokens) { }
[About("Makes the bot teleport to its home region")]
[ReturnHints("ok")]
[Route(HttpVerbs.Get, "/GoHome/{token}")]
public object GoHome(string token)
{
if (tokens.Allow(token, "home", "GoHome", handleGetClientIP()) == false)
{
return Failure("Token not accepted", "GoHome", new [] { });
}
bot.GotoNextHomeRegion();
return BasicReply("ok", "GoHome", new [] { });
}
}
}