From e64a0e67b943470856fb9fbc3510d95d6d333f4c Mon Sep 17 00:00:00 2001 From: Madpeter <57852827+Madpeterz@users.noreply.github.com> Date: Thu, 27 Jun 2024 11:42:34 +0100 Subject: [PATCH] update friendslist reply to be less shit --- SecondBotEvents/Commands/Friends.cs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/SecondBotEvents/Commands/Friends.cs b/SecondBotEvents/Commands/Friends.cs index 2132100..b9b9fa0 100644 --- a/SecondBotEvents/Commands/Friends.cs +++ b/SecondBotEvents/Commands/Friends.cs @@ -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 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; + } }