update friendslist reply to be less shit
This commit is contained in:
parent
b40b2d5b48
commit
e64a0e67b9
1 changed files with 22 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
|||
using OpenMetaverse;
|
||||
using SecondBotEvents.Services;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SecondBotEvents.Commands
|
||||
{
|
||||
|
|
@ -12,10 +12,22 @@ namespace SecondBotEvents.Commands
|
|||
}
|
||||
|
||||
[About("Gets the friendslist")]
|
||||
[ReturnHints("array UUID = friendreplyobject")]
|
||||
[ReturnHints("array of FriendListEntry")]
|
||||
public object Friendslist()
|
||||
{
|
||||
return BasicReply(JsonConvert.SerializeObject(GetClient().Friends.FriendList));
|
||||
Dictionary<UUID, FriendInfo> FriendListCopy = GetClient().Friends.FriendList.Copy();
|
||||
List< FriendListEntry > CleanedFriendsList = new List< FriendListEntry >();
|
||||
int index = 0;
|
||||
foreach (FriendInfo A in FriendListCopy.Values)
|
||||
{
|
||||
FriendListEntry entry = new FriendListEntry();
|
||||
entry.id = A.UUID.ToString();
|
||||
entry.name = A.Name;
|
||||
entry.online = A.IsOnline;
|
||||
CleanedFriendsList.Add(entry);
|
||||
index++;
|
||||
}
|
||||
return BasicReply(JsonConvert.SerializeObject(CleanedFriendsList));
|
||||
}
|
||||
|
||||
[About("Updates the friend perms for avatar avatar to State \n if true grants (Online/Map/Modify) perms")]
|
||||
|
|
@ -89,4 +101,11 @@ namespace SecondBotEvents.Commands
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
class FriendListEntry
|
||||
{
|
||||
public string name;
|
||||
public string id;
|
||||
public bool online = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue