New command: FriendFullPerms
This commit is contained in:
parent
6fc62c461f
commit
c2dd0cf5ff
1 changed files with 42 additions and 0 deletions
42
Core/Commands/Friends/FriendFullPerms.cs
Normal file
42
Core/Commands/Friends/FriendFullPerms.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using OpenMetaverse;
|
||||
namespace BSB.Commands.Movement
|
||||
{
|
||||
public class FriendFullPerms : CoreCommand_2arg
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "Avatar","True|False" }; } }
|
||||
public override string[] ArgHints { get { return new[] { "Avatar UUID or Firstname Lastname","What status should it be" }; } }
|
||||
public override string Helpfile { get { return "Updates the friend perms for avatar [Arg 1] to [Arg 2] (Online/Map/Modify)"; } }
|
||||
public override bool CallFunction(string[] args)
|
||||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
if(UUID.TryParse(args[0],out UUID avatar) == true)
|
||||
{
|
||||
if(bool.TryParse(args[1],out bool status) == true)
|
||||
{
|
||||
if (bot.GetClient.Friends.FriendList.ContainsKey(avatar) == true)
|
||||
{
|
||||
if (status == true)
|
||||
{
|
||||
bot.GetClient.Friends.GrantRights(avatar, FriendRights.CanSeeOnline | FriendRights.CanSeeOnMap | FriendRights.CanModifyObjects);
|
||||
InfoBlob = "Friendship rights granted";
|
||||
}
|
||||
else
|
||||
{
|
||||
bot.GetClient.Friends.GrantRights(avatar, FriendRights.None);
|
||||
InfoBlob = "Friendship rights removed";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return Failed("Avatar not on friends list or friends list has not updated yet");
|
||||
}
|
||||
return Failed("Unable to process arg 2");
|
||||
}
|
||||
return Failed("Unable to process avatar on arg 1");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue