New config value: OnStartLinkUpWithMaster [Default: True]
on login the bot will send a friend request to the master and grant them full friend rights (Online status, Tracking, Object modify)
This commit is contained in:
parent
fcf5eebee8
commit
7f4975c062
4 changed files with 41 additions and 3 deletions
|
|
@ -15,13 +15,15 @@ namespace BetterSecondBotShared.Json
|
||||||
// Security
|
// Security
|
||||||
public bool AllowFunds { get; set; }
|
public bool AllowFunds { get; set; }
|
||||||
|
|
||||||
// Mixed
|
// Settings
|
||||||
public bool allowRLV { get; set; }
|
public bool allowRLV { get; set; }
|
||||||
public string DefaultSitUUID { get; set; }
|
public bool OnStartLinkupWithMaster { get; set; }
|
||||||
|
|
||||||
|
// Mixed
|
||||||
public bool CommandsToConsole { get; set; }
|
public bool CommandsToConsole { get; set; }
|
||||||
public int MaxCommandHistory { get; set; }
|
public int MaxCommandHistory { get; set; }
|
||||||
public string RelayImToAvatar { get; set; }
|
public string RelayImToAvatar { get; set; }
|
||||||
|
|
||||||
// Discord
|
// Discord
|
||||||
public string discordWebhookURL { get; set; }
|
public string discordWebhookURL { get; set; }
|
||||||
public string discordGroupTarget { get; set; }
|
public string discordGroupTarget { get; set; }
|
||||||
|
|
@ -34,6 +36,7 @@ namespace BetterSecondBotShared.Json
|
||||||
public string[] homeRegion { get; set; }
|
public string[] homeRegion { get; set; }
|
||||||
public bool AtHomeSimOnly { get; set; }
|
public bool AtHomeSimOnly { get; set; }
|
||||||
public float AtHomeSimPosMaxRange { get; set; }
|
public float AtHomeSimPosMaxRange { get; set; }
|
||||||
|
public string DefaultSitUUID { get; set; }
|
||||||
|
|
||||||
// HTTP interface
|
// HTTP interface
|
||||||
public bool EnableHttp { get; set; }
|
public bool EnableHttp { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ namespace BetterSecondBotShared.Json
|
||||||
case "athomesimonly": { return "AtHome"; }
|
case "athomesimonly": { return "AtHome"; }
|
||||||
case "athomesimposmaxrange": { return "AtHome"; }
|
case "athomesimposmaxrange": { return "AtHome"; }
|
||||||
case "allowfunds": { return "security"; }
|
case "allowfunds": { return "security"; }
|
||||||
|
case "onstartlinkupwithmaster": { return "Options"; }
|
||||||
default: { return "Unknown"; }
|
default: { return "Unknown"; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -75,6 +76,7 @@ namespace BetterSecondBotShared.Json
|
||||||
case "athomesimonly": { return "Should the @Home system only care if the sim name is correct (use false to use max distance checks)"; }
|
case "athomesimonly": { return "Should the @Home system only care if the sim name is correct (use false to use max distance checks)"; }
|
||||||
case "athomesimposmaxrange": { return "How far away from the location in homeregion can the bot be before teleporting"; }
|
case "athomesimposmaxrange": { return "How far away from the location in homeregion can the bot be before teleporting"; }
|
||||||
case "allowfunds": { return "Allow the bot to transfer L$ to avatars / objects and display its L$ balance via command/web gui"; }
|
case "allowfunds": { return "Allow the bot to transfer L$ to avatars / objects and display its L$ balance via command/web gui"; }
|
||||||
|
case "onstartlinkupwithmaster": { return "After the bot logs in should it send the master a friend request, IM them and request teleport"; }
|
||||||
default: { return "None given"; }
|
default: { return "None given"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -128,6 +130,7 @@ namespace BetterSecondBotShared.Json
|
||||||
case "athomesimonly": { return new[] { "false" }; }
|
case "athomesimonly": { return new[] { "false" }; }
|
||||||
case "athomesimposmaxrange": { return new[] { "10.0" }; }
|
case "athomesimposmaxrange": { return new[] { "10.0" }; }
|
||||||
case "allowfunds": { return new[] { "true" }; }
|
case "allowfunds": { return new[] { "true" }; }
|
||||||
|
case "onstartlinkupwithmaster": { return new[] { "true" }; }
|
||||||
default: { return new string[] { }; }
|
default: { return new string[] { }; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,10 +228,16 @@ namespace BSB.bottypes
|
||||||
Client.Self.IM += MessageHandler;
|
Client.Self.IM += MessageHandler;
|
||||||
Client.Groups.CurrentGroups += GroupsHandler;
|
Client.Groups.CurrentGroups += GroupsHandler;
|
||||||
Client.Self.ScriptQuestion += PermissionsHandler;
|
Client.Self.ScriptQuestion += PermissionsHandler;
|
||||||
|
Client.Friends.FriendshipResponse += FriendshipResponse;
|
||||||
delay_group_fetch = helpers.UnixTimeNow() + 10;
|
delay_group_fetch = helpers.UnixTimeNow() + 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void FriendshipResponse(object o, FriendshipResponseEventArgs E)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected override void PermissionsHandler(object sender, ScriptQuestionEventArgs e)
|
protected override void PermissionsHandler(object sender, ScriptQuestionEventArgs e)
|
||||||
{
|
{
|
||||||
if(e.ObjectOwnerName == Client.Self.Name)
|
if(e.ObjectOwnerName == Client.Self.Name)
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,36 @@ using OpenMetaverse;
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Webhook;
|
using Discord.Webhook;
|
||||||
using BetterSecondBotShared.Json;
|
using BetterSecondBotShared.Json;
|
||||||
|
using BetterSecondBotShared.Static;
|
||||||
|
|
||||||
namespace BSB.bottypes
|
namespace BSB.bottypes
|
||||||
{
|
{
|
||||||
public class SecondBot : DialogsBot
|
public class SecondBot : DialogsBot
|
||||||
{
|
{
|
||||||
|
protected override void AfterBotLoginHandler()
|
||||||
|
{
|
||||||
|
base.AfterBotLoginHandler();
|
||||||
|
if (helpers.notempty(myconfig.master) == true)
|
||||||
|
{
|
||||||
|
if (myconfig.OnStartLinkupWithMaster == true)
|
||||||
|
{
|
||||||
|
CommandsInterface.Call("IM", String.Join("~#~", new string[] { myconfig.master, "Hello master I am now online and ready to accept teleport offers" }));
|
||||||
|
CommandsInterface.Call("FriendRequest", myconfig.master, Client.Self.AgentID);
|
||||||
|
CommandsInterface.Call("FriendFullPerms", String.Join("~#~", new string[] { myconfig.master, "true" }), Client.Self.AgentID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void FriendshipResponse(object o,FriendshipResponseEventArgs E)
|
||||||
|
{
|
||||||
|
base.FriendshipResponse(o, E);
|
||||||
|
if(E.Accepted == true)
|
||||||
|
{
|
||||||
|
if(E.AgentName == myconfig.master)
|
||||||
|
{
|
||||||
|
CommandsInterface.Call("FriendFullPerms", String.Join("~#~", new string[] { myconfig.master, "true" }), Client.Self.AgentID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue