From a255e6637989a7a71ce61d9914256fcb9462c463 Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Tue, 6 Dec 2022 02:14:32 +0100 Subject: [PATCH 1/5] did stuff Moved. icon and banners to Media/ Added Events: - onChatContentChanged - onChatAnnouncementPin - onChatAnnouncementUnPin - onChatViewModeOn - onChatViewModeOff - onChatTipEnabled - onChatTipDisabled - onMessageForceRemovedByAdmin - onChatTip --- Amino.NET/Amino.NET.csproj | 4 +- Amino.NET/Client.cs | 84 +++++++++++ Amino.NET/Events/EventHandler.cs | 39 ++++- Amino.NET/{ => Media}/Amino.Net-Banner-V1.png | Bin Amino.NET/{ => Media}/Amino.Net-Banner-V2.png | Bin Amino.NET/{ => Media}/Amino.Net-Logo-V2.png | Bin Amino.NET/{ => Media}/Amino.Net-Logo.png | Bin Amino.NET/Objects/ChatAnnouncement.cs | 49 +++++++ Amino.NET/Objects/ChatTip.cs | 134 ++++++++++++++++++ Amino.NET/Objects/ChatTipToggle.cs | 121 ++++++++++++++++ Amino.NET/Objects/SpecialChatEvent.cs | 125 ++++++++++++++++ Amino.NET/Objects/ViewMode.cs | 122 ++++++++++++++++ 12 files changed, 675 insertions(+), 3 deletions(-) rename Amino.NET/{ => Media}/Amino.Net-Banner-V1.png (100%) rename Amino.NET/{ => Media}/Amino.Net-Banner-V2.png (100%) rename Amino.NET/{ => Media}/Amino.Net-Logo-V2.png (100%) rename Amino.NET/{ => Media}/Amino.Net-Logo.png (100%) create mode 100644 Amino.NET/Objects/ChatAnnouncement.cs create mode 100644 Amino.NET/Objects/ChatTip.cs create mode 100644 Amino.NET/Objects/ChatTipToggle.cs create mode 100644 Amino.NET/Objects/SpecialChatEvent.cs create mode 100644 Amino.NET/Objects/ViewMode.cs diff --git a/Amino.NET/Amino.NET.csproj b/Amino.NET/Amino.NET.csproj index ae1ffbf..e93bdd4 100644 --- a/Amino.NET/Amino.NET.csproj +++ b/Amino.NET/Amino.NET.csproj @@ -2,7 +2,7 @@ net5.0 - 1.1.0-Dev-6.9.2.9 + 1.1.0-Dev-6.9.3 FabioTheFox FabiDev An unofficial C# wrapper for Aminos REST API for making amino bots and tools @@ -36,7 +36,7 @@ - + True diff --git a/Amino.NET/Client.cs b/Amino.NET/Client.cs index 62aa562..e2de1d5 100644 --- a/Amino.NET/Client.cs +++ b/Amino.NET/Client.cs @@ -131,6 +131,18 @@ public class Client /// Fires each time an Amino chat title has been changed (only chats where the current Amino account is in) /// public event Action onChatTitleChanged; + /// + /// Fires each time an Amino chat content has been changed (only in chats where the currnt Amino account is in) + /// + public event Action onChatContentChanged; + public event Action onChatAnnouncementPin; + public event Action onChatAnnouncementUnpin; + public event Action onChatViewModeOn; + public event Action onChatViewModeOff; + public event Action onChatTipEnabled; + public event Action onChatTipDisabled; + public event Action onMessageForceRemovedByAdmin; + public event Action onChatTip; //headers. private IDictionary headers = new Dictionary(); @@ -2407,6 +2419,78 @@ public void callChatTitleChangedEvent(Amino.Client _client, Amino.Objects.ChatEv _client.onChatTitleChanged.Invoke(_chatEvent); } } + + public void callChatContentChangedEvent(Amino.Client _client, Amino.Objects.ChatEvent _chatEvent) + { + if(_client.onChatContentChanged != null) + { + _client.onChatContentChanged.Invoke(_chatEvent); + } + } + + public void callChatPinAnnouncementEvent(Amino.Client _client, Amino.Objects.ChatAnnouncement _chatAnnouncement) + { + if(_client.onChatAnnouncementPin != null) + { + _client.onChatAnnouncementPin.Invoke(_chatAnnouncement); + } + } + + public void callChatUnpinAnnouncementEvent(Amino.Client _client, Amino.Objects.ChatEvent _chatEvent) + { + if(_client.onChatAnnouncementUnpin != null) + { + _client.onChatAnnouncementUnpin.Invoke(_chatEvent); + } + } + + public void callChatViewModeOnEvent(Amino.Client _client, Amino.Objects.ViewMode _viewMode) + { + if(_client.onChatViewModeOn != null) + { + _client.onChatViewModeOn.Invoke(_viewMode); + } + } + + public void callChatViewModeOffEvent(Amino.Client _client, Amino.Objects.ViewMode _viewMode) + { + if(_client.onChatViewModeOff != null) + { + _client.onChatViewModeOff.Invoke(_viewMode); + } + } + + public void callChatTipEnabledEvent(Amino.Client _client, Amino.Objects.ChatTipToggle _chatTip) + { + if(_client.onChatTipEnabled != null) + { + _client.onChatTipEnabled.Invoke(_chatTip); + } + } + + public void callChatTipDisabledEvent(Amino.Client _client, Amino.Objects.ChatTipToggle _chatTip) + { + if(_client.onChatTipDisabled != null) + { + _client.onChatTipDisabled.Invoke(_chatTip); + } + } + + public void callMessageForceRemovedByAdminEvent(Amino.Client _client, Amino.Objects.SpecialChatEvent _chatEvent) + { + if(_client.onMessageForceRemovedByAdmin != null) + { + _client.onMessageForceRemovedByAdmin.Invoke(_chatEvent); + } + } + + public void callChatTipEvent(Amino.Client _client, Amino.Objects.ChatTip _chatTip) + { + if(_client.onChatTip != null) + { + _client.onChatTip.Invoke(_chatTip); + } + } } } } diff --git a/Amino.NET/Events/EventHandler.cs b/Amino.NET/Events/EventHandler.cs index bfc342e..e0d2e6d 100644 --- a/Amino.NET/Events/EventHandler.cs +++ b/Amino.NET/Events/EventHandler.cs @@ -30,7 +30,7 @@ public Task ReceiveEvent(JObject webSocketMessage, Client client) { switch((int)jsonObj["o"]["chatMessage"]["mediaType"]) { - case 0: //TextMessage / MessageDeleted / ChatMember Left, ChatMember Joined / ChatBackground changed / ChatTitle changed + case 0: //TextMessage / MessageDeleted / ChatMember Left, ChatMember Joined / ChatBackground changed / ChatTitle changed / ChatContent chaaged / ChatAnnouncementPin / ChatAnnouncementUnpin / ChatViewOnlyOn / ChatViewOnlyOff / ChatTipEnabled / ChatTipDisabled / MessageForceRemoved / ChatTip switch((int)jsonObj["o"]["chatMessage"]["type"]) { case 0: //Textmessage recevied @@ -57,6 +57,43 @@ public Task ReceiveEvent(JObject webSocketMessage, Client client) Amino.Objects.ChatEvent _chatTitleChanged = new Objects.ChatEvent(webSocketMessage); eventCall.callChatTitleChangedEvent(client, _chatTitleChanged); break; + case 113: // ChatContent Changed + Amino.Objects.ChatEvent _chatContentChanged = new Objects.ChatEvent(webSocketMessage); + eventCall.callChatContentChangedEvent(client, _chatContentChanged); + break; + case 119: // MessageForceRemovedByAdmin + Amino.Objects.SpecialChatEvent _messageForceRemovedByAdmin = new Objects.SpecialChatEvent(webSocketMessage); + eventCall.callMessageForceRemovedByAdminEvent(client, _messageForceRemovedByAdmin); + break; + case 120: // ChatTip + Amino.Objects.ChatTip _chatTip = new Objects.ChatTip(webSocketMessage); + eventCall.callChatTipEvent(client, _chatTip); + break; + case 121: // ChatAnnouncementPin + Amino.Objects.ChatAnnouncement _chatAnnouncementPinEvent = new Objects.ChatAnnouncement(webSocketMessage); + eventCall.callChatPinAnnouncementEvent(client, _chatAnnouncementPinEvent); + break; + case 125: // ChatViewModeOn + Amino.Objects.ViewMode _viewModeOn = new Objects.ViewMode(webSocketMessage); + eventCall.callChatViewModeOnEvent(client, _viewModeOn); + break; + case 126: // ChatViewModeOff + Amino.Objects.ViewMode _viewModeOff = new Objects.ViewMode(webSocketMessage); + eventCall.callChatViewModeOffEvent(client, _viewModeOff); + break; + case 127: // ChatAnnouncementUnPin + Amino.Objects.ChatEvent _chatAnnouncementUnPin = new Objects.ChatEvent(webSocketMessage); + eventCall.callChatUnpinAnnouncementEvent(client, _chatAnnouncementUnPin); + break; + case 128: // ChatTipEnabled + Amino.Objects.ChatTipToggle _chatTipEnabled = new Objects.ChatTipToggle(webSocketMessage); + eventCall.callChatTipEnabledEvent(client, _chatTipEnabled); + break; + case 129: // ChatTipDisabled + Amino.Objects.ChatTipToggle _chatTipDisabled = new Objects.ChatTipToggle(webSocketMessage); + eventCall.callChatTipDisabledEvent(client, _chatTipDisabled); + break; + } break; diff --git a/Amino.NET/Amino.Net-Banner-V1.png b/Amino.NET/Media/Amino.Net-Banner-V1.png similarity index 100% rename from Amino.NET/Amino.Net-Banner-V1.png rename to Amino.NET/Media/Amino.Net-Banner-V1.png diff --git a/Amino.NET/Amino.Net-Banner-V2.png b/Amino.NET/Media/Amino.Net-Banner-V2.png similarity index 100% rename from Amino.NET/Amino.Net-Banner-V2.png rename to Amino.NET/Media/Amino.Net-Banner-V2.png diff --git a/Amino.NET/Amino.Net-Logo-V2.png b/Amino.NET/Media/Amino.Net-Logo-V2.png similarity index 100% rename from Amino.NET/Amino.Net-Logo-V2.png rename to Amino.NET/Media/Amino.Net-Logo-V2.png diff --git a/Amino.NET/Amino.Net-Logo.png b/Amino.NET/Media/Amino.Net-Logo.png similarity index 100% rename from Amino.NET/Amino.Net-Logo.png rename to Amino.NET/Media/Amino.Net-Logo.png diff --git a/Amino.NET/Objects/ChatAnnouncement.cs b/Amino.NET/Objects/ChatAnnouncement.cs new file mode 100644 index 0000000..eb0e02b --- /dev/null +++ b/Amino.NET/Objects/ChatAnnouncement.cs @@ -0,0 +1,49 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class ChatAnnouncement + { + public int _type { get; } + public int communityId { get; } + public int alertOption { get; } + public int membershipStatus { get; } + + public string chatId { get; } + public int mediaType { get; } + public string content { get; } + public int clientRefId { get; } + public string messageId { get; } + public string userId { get; } + public string createdTime { get; } + public int type { get; } + public bool isHidden { get; } + public bool includedInSummary { get; } + public string json { get; } + + public ChatAnnouncement(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + _type = (int)jsonObj["t"]; + communityId = (int)jsonObj["o"]["ndcId"]; + alertOption = (int)jsonObj["o"]["alertOption"]; + membershipStatus = (int)jsonObj["o"]["membershipStatus"]; + + chatId = (string)jsonObj["o"]["chatMessage"]["threadId"]; + mediaType = (int)jsonObj["o"]["chatMessage"]["mediaType"]; + content = (string)jsonObj["o"]["chatMessage"]["content"]; + clientRefId = (int)jsonObj["o"]["chatMessage"]["clientRefId"]; + messageId = (string)jsonObj["o"]["chatMessage"]["messageId"]; + userId = (string)jsonObj["o"]["chatMessage"]["uid"]; + createdTime = (string)jsonObj["o"]["chatMessage"]["createdTime"]; + type = (int)jsonObj["o"]["chatMessage"]["type"]; + isHidden = (bool)jsonObj["o"]["chatMessage"]["isHidden"]; + includedInSummary = (bool)jsonObj["o"]["chatMessage"]["includedInSummary"]; + json = _json.ToString(); + } + + } +} diff --git a/Amino.NET/Objects/ChatTip.cs b/Amino.NET/Objects/ChatTip.cs new file mode 100644 index 0000000..8270103 --- /dev/null +++ b/Amino.NET/Objects/ChatTip.cs @@ -0,0 +1,134 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class ChatTip + { + public int _type { get; } + public int alertOption { get; } + public int membershipStatus { get; } + public int communityId { get; } + + public string chatId { get; } + public int mediaType { get; } + public int clientRefId { get; } + public string messageId { get; } + public string userId { get; } + public string createdTime { get; } + public int type { get; } + public bool isHidden { get; } + public bool includedInSummary { get; } + public string json { get; } + public _Author Author { get; } + public _Extensions Extensions { get; } + + + public ChatTip(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + _type = (int)jsonObj["t"]; + alertOption = (int)jsonObj["o"]["alertOption"]; + membershipStatus = (int)jsonObj["o"]["membershipStatus"]; + communityId = (int)jsonObj["o"]["ndcId"]; + + chatId = (string)jsonObj["o"]["chatMessage"]["threadId"]; + mediaType = (int)jsonObj["o"]["chatMessage"]["mediaType"]; + clientRefId = (int)jsonObj["o"]["chatMessage"]["clientRefId"]; + messageId = (string)jsonObj["o"]["chatMessage"]["messageId"]; + userId = (string)jsonObj["o"]["chatMessage"]["uid"]; + createdTime = (string)jsonObj["o"]["chatMessage"]["createdTime"]; + type = (int)jsonObj["o"]["chatMessage"]["type"]; + isHidden = (bool)jsonObj["o"]["chatMessage"]["isHidden"]; + includedInSummary = (bool)jsonObj["o"]["chatMessage"]["includedInSummary"]; + json = _json.ToString(); + Author = new _Author(_json); + Extensions = new _Extensions(_json); + + } + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _Author + { + public string userId { get; } + public int status { get; } + public string iconUrl { get; } + public int reputation { get; } + public int role { get; } + public string nickname { get; } + public int level { get; } + public int accountMembershipStatus { get; } + public string avatarFrameId { get; } + public _AvatarFrame AvatarFrame { get; } + public _InfluencerInfo InfluencerInfo { get; } + + public _Author(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + userId = (string)jsonObj["o"]["chatMessage"]["author"]["uid"]; + status = (int)jsonObj["o"]["chatMessage"]["author"]["status"]; + if(jsonObj["o"]["chatMessage"]["author"]["icon"] != null) { iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["icon"]; } + reputation = (int)jsonObj["o"]["chatMessage"]["author"]["reputation"]; + role = (int)jsonObj["o"]["chatMessage"]["author"]["role"]; + nickname = (string)jsonObj["o"]["chatMessage"]["author"]["nickname"]; + level = (int)jsonObj["o"]["chatMessage"]["author"]["level"]; + accountMembershipStatus = (int)jsonObj["o"]["chatMessage"]["author"]["accountMembershipStatus"]; + avatarFrameId = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrameId"]; + if(jsonObj["o"]["chatMessage"]["author"]["avatarFrame"] != null) { AvatarFrame = new _AvatarFrame(_json); } + if(jsonObj["o"]["chatMessage"]["author"]["influencerInfo"] != null) { InfluencerInfo = new _InfluencerInfo(_json); } + } + + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _AvatarFrame + { + public int status { get; } + public int version { get; } + public string resourceUrl { get; } + public string name { get; } + public string iconUrl { get; } + public int frameType { get; } + public string frameId { get; } + + public _AvatarFrame(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + status = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["status"]; + version = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["version"]; + resourceUrl = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["resourceUrl"]; + name = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["name"]; + iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["icon"]; + frameType = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["frameType"]; + frameId = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["frameId"]; + } + } + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _InfluencerInfo + { + public int fansCount { get; } + public int monthlyFee { get; } + + public _InfluencerInfo(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + fansCount = (int)jsonObj["o"]["chatMessage"]["author"]["influencerInfo"]["fansCount"]; + monthlyFee = (int)jsonObj["o"]["chatMessage"]["author"]["influencerInfo"]["monthlyFee"]; + } + } + } + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _Extensions + { + public int tippedCoins { get; } + + public _Extensions(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + tippedCoins = (int)jsonObj["o"]["chatMessage"]["extensions"]["tippingCoins"]; + } + } + } +} diff --git a/Amino.NET/Objects/ChatTipToggle.cs b/Amino.NET/Objects/ChatTipToggle.cs new file mode 100644 index 0000000..3d843b6 --- /dev/null +++ b/Amino.NET/Objects/ChatTipToggle.cs @@ -0,0 +1,121 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class ChatTipToggle + { + public int _type { get; } + public int communityId { get; } + public int alertOption { get; } + public int membershipStatus { get; } + + public string chatId { get; } + public int mediaType { get; } + public int clientRefId { get; } + public string messageId { get; } + public string userId { get; } + public string createdTime { get; } + public int type { get; } + public bool isHidden { get; } + public bool includedInSummary { get; } + public string json { get; } + public _Author Author { get; } + + public ChatTipToggle(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + _type = (int)jsonObj["t"]; + communityId = (int)jsonObj["o"]["ndcId"]; + alertOption = (int)jsonObj["o"]["alertOption"]; + membershipStatus = (int)jsonObj["o"]["membershipStatus"]; + + chatId = (string)jsonObj["o"]["chatMessage"]["threadId"]; + mediaType = (int)jsonObj["o"]["chatMessage"]["mediaType"]; + clientRefId = (int)jsonObj["o"]["chatMessage"]["clientRefId"]; + messageId = (string)jsonObj["o"]["chatMessage"]["messageId"]; + userId = (string)jsonObj["o"]["chatMessage"]["uid"]; + createdTime = (string)jsonObj["o"]["chatMessage"]["createdTime"]; + type = (int)jsonObj["o"]["chatMessage"]["type"]; + isHidden = (bool)jsonObj["o"]["chatMessage"]["isHidden"]; + includedInSummary = (bool)jsonObj["o"]["chatMessage"]["includedInSummary"]; + json = _json.ToString(); + Author = new _Author(_json); + } + + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _Author + { + public string userId { get; } + public int status { get; } + public string iconUrl { get; } + public int reputation { get; } + public int role { get; } + public string nickname { get; } + public int level { get; } + public int accountMembershipStatus { get; } + public _AvatarFrame AvatarFrame { get; } + public _InfluencerInfo InfluencerInfo { get; } + + public _Author(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + userId = (string)jsonObj["o"]["chatMessage"]["author"]["uid"]; + status = (int)jsonObj["o"]["chatMessage"]["author"]["status"]; + if (jsonObj["o"]["chatMessage"]["author"]["icon"] != null) { iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["icon"]; } + reputation = (int)jsonObj["o"]["chatMessage"]["author"]["reputation"]; + role = (int)jsonObj["o"]["chatMessage"]["author"]["role"]; + nickname = (string)jsonObj["o"]["chatMessage"]["author"]["nickname"]; + level = (int)jsonObj["o"]["chatMessage"]["author"]["level"]; + accountMembershipStatus = (int)jsonObj["o"]["chatMessage"]["author"]["accountMembershipStatus"]; + if (jsonObj["o"]["chatMessage"]["author"]["avatarFrame"] != null) { AvatarFrame = new _AvatarFrame(_json); } + if (jsonObj["o"]["chatMessage"]["author"]["influencerInfo"] != null) { InfluencerInfo = new _InfluencerInfo(_json); } + + + } + + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _AvatarFrame + { + public int status { get; } + public int version { get; } + public string resourceUrl { get; } + public string name { get; } + public string iconUrl { get; } + public int frameType { get; } + public string frameId { get; } + + public _AvatarFrame(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + status = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["status"]; + version = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["version"]; + resourceUrl = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["resourceUrl"]; + name = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["name"]; + iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["icon"]; + frameType = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["frameType"]; + frameId = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["frameId"]; + } + } + + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _InfluencerInfo + { + public int fansCount { get; } + public int monthlyFee { get; } + + public _InfluencerInfo(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + fansCount = (int)jsonObj["o"]["chatMessage"]["author"]["influencerInfo"]["fansCount"]; + monthlyFee = (int)jsonObj["o"]["chatMessage"]["author"]["influencerInfo"]["monthlyFee"]; + } + } + } + } +} diff --git a/Amino.NET/Objects/SpecialChatEvent.cs b/Amino.NET/Objects/SpecialChatEvent.cs new file mode 100644 index 0000000..5c4a874 --- /dev/null +++ b/Amino.NET/Objects/SpecialChatEvent.cs @@ -0,0 +1,125 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class SpecialChatEvent + { + + public int _type { get; } + public int communityId { get; } + public int alertOption { get; } + public int membershipStatus { get; } + + public string chatId { get; } + public int mediaType { get; } + public int clientRefId { get; } + public string messageId { get; } + public string userId { get; } + public string createdTime { get; } + public int type { get; } + public bool isHidden { get; } + public bool includedInSummary { get; } + public string json { get; } + public _Author Author { get; } + + public SpecialChatEvent(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + _type = (int)jsonObj["t"]; + communityId = (int)jsonObj["o"]["ndcId"]; + alertOption = (int)jsonObj["o"]["alertOption"]; + membershipStatus = (int)jsonObj["o"]["membershipStatus"]; + + chatId = (string)jsonObj["o"]["chatMessage"]["threadId"]; + mediaType = (int)jsonObj["o"]["chatMessage"]["mediaType"]; + clientRefId = (int)jsonObj["o"]["chatMessage"]["clientRefId"]; + messageId = (string)jsonObj["o"]["chatMessage"]["messageId"]; + userId = (string)jsonObj["o"]["chatMessage"]["uid"]; + createdTime = (string)jsonObj["o"]["chatMessage"]["createdTime"]; + type = (int)jsonObj["o"]["chatMessage"]["type"]; + isHidden = (bool)jsonObj["o"]["chatMessage"]["isHidden"]; + includedInSummary = (bool)jsonObj["o"]["chatMessage"]["includedInSummary"]; + json = _json.ToString(); + Author = new _Author(_json); + } + + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _Author + { + public string userId { get; } + public int status { get; } + public string iconUrl { get; } + public int reputation { get; } + public int role { get; } + public string nickname { get; } + public int level { get; } + public int accountMembershipStatus { get; } + public _AvatarFrame AvatarFrame { get; } + public _InfluencerInfo InfluencerInfo { get; } + + public _Author(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + userId = (string)jsonObj["o"]["chatMessage"]["author"]["uid"]; + status = (int)jsonObj["o"]["chatMessage"]["author"]["status"]; + if (jsonObj["o"]["chatMessage"]["author"]["icon"] != null) { iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["icon"]; } + reputation = (int)jsonObj["o"]["chatMessage"]["author"]["reputation"]; + role = (int)jsonObj["o"]["chatMessage"]["author"]["role"]; + nickname = (string)jsonObj["o"]["chatMessage"]["author"]["nickname"]; + level = (int)jsonObj["o"]["chatMessage"]["author"]["level"]; + accountMembershipStatus = (int)jsonObj["o"]["chatMessage"]["author"]["accountMembershipStatus"]; + if (jsonObj["o"]["chatMessage"]["author"]["avatarFrame"] != null) { AvatarFrame = new _AvatarFrame(_json); } + if (jsonObj["o"]["chatMessage"]["author"]["influencerInfo"] != null) { InfluencerInfo = new _InfluencerInfo(_json); } + + + } + + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _AvatarFrame + { + public int status { get; } + public int version { get; } + public string resourceUrl { get; } + public string name { get; } + public string iconUrl { get; } + public int frameType { get; } + public string frameId { get; } + + public _AvatarFrame(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + status = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["status"]; + version = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["version"]; + resourceUrl = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["resourceUrl"]; + name = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["name"]; + iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["icon"]; + frameType = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["frameType"]; + frameId = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["frameId"]; + } + } + + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _InfluencerInfo + { + public int fansCount { get; } + public int monthlyFee { get; } + + public _InfluencerInfo(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + fansCount = (int)jsonObj["o"]["chatMessage"]["author"]["influencerInfo"]["fansCount"]; + monthlyFee = (int)jsonObj["o"]["chatMessage"]["author"]["influencerInfo"]["monthlyFee"]; + } + } + } + + + + } +} diff --git a/Amino.NET/Objects/ViewMode.cs b/Amino.NET/Objects/ViewMode.cs new file mode 100644 index 0000000..f9dd99d --- /dev/null +++ b/Amino.NET/Objects/ViewMode.cs @@ -0,0 +1,122 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class ViewMode + { + public int _type { get; } + public int communityId { get; } + public int alertOption { get; } + public int membershipStatus { get; } + + public string chatId { get; } + public int mediaType { get; } + public int clientRefId { get; } + public string messageId { get; } + public string userId { get; } + public string createdTime { get; } + public int type { get; } + public bool isHidden { get; } + public bool includedInSummary { get; } + public string json { get; } + public _Author Author { get; } + + public ViewMode(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + _type = (int)jsonObj["t"]; + communityId = (int)jsonObj["o"]["ndcId"]; + alertOption = (int)jsonObj["o"]["alertOption"]; + membershipStatus = (int)jsonObj["o"]["membershipStatus"]; + + chatId = (string)jsonObj["o"]["chatMessage"]["threadId"]; + mediaType = (int)jsonObj["o"]["chatMessage"]["mediaType"]; + clientRefId = (int)jsonObj["o"]["chatMessage"]["clientRefId"]; + messageId = (string)jsonObj["o"]["chatMessage"]["messageId"]; + userId = (string)jsonObj["o"]["chatMessage"]["uid"]; + createdTime = (string)jsonObj["o"]["chatMessage"]["createdTime"]; + type = (int)jsonObj["o"]["chatMessage"]["type"]; + isHidden = (bool)jsonObj["o"]["chatMessage"]["isHidden"]; + includedInSummary = (bool)jsonObj["o"]["chatMessage"]["includedInSummary"]; + json = _json.ToString(); + Author = new _Author(_json); + + } + + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _Author + { + public string userId { get; } + public int status { get; } + public string iconUrl { get; } + public int reputation { get; } + public int role { get; } + public string nickname { get; } + public int level { get; } + public int accountMembershipStatus { get; } + public _AvatarFrame AvatarFrame { get; } + public _InfluencerInfo InfluencerInfo { get; } + + public _Author(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + userId = (string)jsonObj["o"]["chatMessage"]["author"]["uid"]; + status = (int)jsonObj["o"]["chatMessage"]["author"]["status"]; + if(jsonObj["o"]["chatMessage"]["author"]["icon"] != null) { iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["icon"]; } + reputation = (int)jsonObj["o"]["chatMessage"]["author"]["reputation"]; + role = (int)jsonObj["o"]["chatMessage"]["author"]["role"]; + nickname = (string)jsonObj["o"]["chatMessage"]["author"]["nickname"]; + level = (int)jsonObj["o"]["chatMessage"]["author"]["level"]; + accountMembershipStatus = (int)jsonObj["o"]["chatMessage"]["author"]["accountMembershipStatus"]; + if(jsonObj["o"]["chatMessage"]["author"]["avatarFrame"] != null) { AvatarFrame = new _AvatarFrame(_json); } + if(jsonObj["o"]["chatMessage"]["author"]["influencerInfo"] != null) { InfluencerInfo = new _InfluencerInfo(_json); } + + + } + + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _AvatarFrame + { + public int status { get; } + public int version { get; } + public string resourceUrl { get; } + public string name { get; } + public string iconUrl { get; } + public int frameType { get; } + public string frameId { get; } + + public _AvatarFrame(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + status = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["status"]; + version = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["version"]; + resourceUrl = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["resourceUrl"]; + name = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["name"]; + iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["icon"]; + frameType = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["frameType"]; + frameId = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["frameId"]; + } + } + + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _InfluencerInfo + { + public int fansCount { get; } + public int monthlyFee { get; } + + public _InfluencerInfo(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + fansCount = (int)jsonObj["o"]["chatMessage"]["author"]["influencerInfo"]["fansCount"]; + monthlyFee = (int)jsonObj["o"]["chatMessage"]["author"]["influencerInfo"]["monthlyFee"]; + } + } + } + } +} From 9a08ef94946ac24678b99b6b84ed3e3003b86602 Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Sat, 21 Jan 2023 11:16:19 +0100 Subject: [PATCH 2/5] changed stuff Changed: Version Changed: Encryption Keys --- Amino.NET/Amino.NET.csproj | 2 +- Amino.NET/helpers.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Amino.NET/Amino.NET.csproj b/Amino.NET/Amino.NET.csproj index ae1ffbf..cbd431d 100644 --- a/Amino.NET/Amino.NET.csproj +++ b/Amino.NET/Amino.NET.csproj @@ -2,7 +2,7 @@ net5.0 - 1.1.0-Dev-6.9.2.9 + 1.2.0 FabioTheFox FabiDev An unofficial C# wrapper for Aminos REST API for making amino bots and tools diff --git a/Amino.NET/helpers.cs b/Amino.NET/helpers.cs index fd3accc..e399e13 100644 --- a/Amino.NET/helpers.cs +++ b/Amino.NET/helpers.cs @@ -39,8 +39,8 @@ private static byte[] StringToByteArray(string hex) /// string : The signiture. public static string generate_signiture(string data) { - string prefix = "52"; - string key = "EAB4F1B9E3340CD1631EDE3B587CC3EBEDF1AFA9".ToLower(); + string prefix = "19"; + string key = "DFA5ED192DDA6E88A12FE12130DC6206B1251E44".ToLower(); HMACSHA1 hmac = new HMACSHA1(StringToByteArray(key)); byte[] buffer = Encoding.Default.GetBytes(data); @@ -56,7 +56,7 @@ public static string generate_signiture(string data) public static string generate_file_signiture(byte[] data) { string prefix = "52"; - string key = "EAB4F1B9E3340CD1631EDE3B587CC3EBEDF1AFA9".ToLower(); + string key = "DFA5ED192DDA6E88A12FE12130DC6206B1251E44".ToLower(); HMACSHA1 hmac = new HMACSHA1(StringToByteArray(key)); byte[] result = hmac.ComputeHash(data); return Convert.ToBase64String(CombineTwoArrays(StringToByteArray(prefix), result)); @@ -68,8 +68,8 @@ public static string generate_file_signiture(byte[] data) /// string : The Device ID public static string generate_device_id() { - string prefix = "52"; - string key = "AE49550458D8E7C51D566916B04888BFB8B3CA7D".ToLower(); + string prefix = "19"; + string key = "E7309ECC0953C6FA60005B2765F99DBBC965C8E9".ToLower(); Random rnd = new Random(); byte[] identifier = new byte[20]; From 2d002af088c9f77556880a0561e510a59ad2e6a7 Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Sat, 21 Jan 2023 11:21:23 +0100 Subject: [PATCH 3/5] fixed prefix --- Amino.NET/helpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Amino.NET/helpers.cs b/Amino.NET/helpers.cs index e399e13..aa160d0 100644 --- a/Amino.NET/helpers.cs +++ b/Amino.NET/helpers.cs @@ -55,7 +55,7 @@ public static string generate_signiture(string data) /// string : The signiture. public static string generate_file_signiture(byte[] data) { - string prefix = "52"; + string prefix = "19"; string key = "DFA5ED192DDA6E88A12FE12130DC6206B1251E44".ToLower(); HMACSHA1 hmac = new HMACSHA1(StringToByteArray(key)); byte[] result = hmac.ComputeHash(data); From 2fab1dd8996dd0b92f60f9e50819f7b023a7f41f Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Sat, 21 Jan 2023 11:23:05 +0100 Subject: [PATCH 4/5] . --- Amino.NET/Amino.NET.csproj | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Amino.NET/Amino.NET.csproj b/Amino.NET/Amino.NET.csproj index cbd431d..d90ece0 100644 --- a/Amino.NET/Amino.NET.csproj +++ b/Amino.NET/Amino.NET.csproj @@ -35,11 +35,4 @@ - - - True - - - - From 293165c9e1960d7c7beb182bdbb9e0e2db4d87be Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Sat, 21 Jan 2023 11:26:45 +0100 Subject: [PATCH 5/5] . . --- Amino.NET/Amino.NET.csproj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Amino.NET/Amino.NET.csproj b/Amino.NET/Amino.NET.csproj index d90ece0..ee80cbc 100644 --- a/Amino.NET/Amino.NET.csproj +++ b/Amino.NET/Amino.NET.csproj @@ -35,4 +35,11 @@ + + + True + + + +