public static CustomEmoji Parse(JObject m) { CustomEmoji emoji = new CustomEmoji(); if (m["_id"] != null) { emoji.Id = (m["_id"] as JValue).Value <string>(); } if (m["name"] != null) { emoji.Name = (m["name"] as JValue).Value <string>(); } if (m["roles"] != null) { var roles = m["roles"]; emoji.Aliases = new List <string>(); foreach (var obj in roles as JArray) { emoji.Aliases.Add((obj as JValue).Value <string>()); } } if (m["extension"] != null) { emoji.Extension = (m["extension"] as JValue).Value <string>(); } // Todo process date return(emoji); }
/// <summary> /// Returns a list of custom emoji registered with the server. /// </summary> /// <returns>The custom emoji.</returns> public async Task <List <CustomEmoji> > ListCustomEmoji() { var arg = await _meteor.CallWithResult("listEmojiCustom", new object[] { }); List <CustomEmoji> users = new List <CustomEmoji>(); var result = arg["result"] as JArray; foreach (var user in result) { users.Add(CustomEmoji.Parse(user as JObject)); } return(users); }