diff --git a/Amino.NET/Amino.NET.csproj b/Amino.NET/Amino.NET.csproj index 4a0d619..ae1ffbf 100644 --- a/Amino.NET/Amino.NET.csproj +++ b/Amino.NET/Amino.NET.csproj @@ -2,7 +2,7 @@ net5.0 - 1.0.0-Dev-6.9.2.1 + 1.1.0-Dev-6.9.2.9 FabioTheFox FabiDev An unofficial C# wrapper for Aminos REST API for making amino bots and tools diff --git a/Amino.NET/Amino.NET.xml b/Amino.NET/Amino.NET.xml index 804341b..cf4e5d4 100644 --- a/Amino.NET/Amino.NET.xml +++ b/Amino.NET/Amino.NET.xml @@ -99,6 +99,46 @@ Fires each time an Amino WebSocket Message has been receveived by the current Amino Client + + + Fires each time an Amino YouTube message has been received by the current Amino account + + + + + Fires each time an Amino Voice message / note has been received by the current Amino account + + + + + Fires each time an Amino Sticker message has been received by the current Amino account + + + + + Fires each time an Amino message has been deleted (in a chat where the current Amino account is in) + + + + + Fires each time an Amino member joined a chat where the current Amino account is in + + + + + Fires each time an Amino member left a chat where the current Amino account is in + + + + + Fires each time an Amino chat background has changed (only chats where the current Amino account is in) + + + + + Fires each time an Amino chat title has been changed (only chats where the current Amino account is in) + + Creates an instance of the Amino.Client object and builds headers @@ -116,7 +156,7 @@ - + Allows you to log into your account This function will set all client values and wíll enable the webSocket to activate @@ -127,14 +167,14 @@ - + Allows you to log out of the current account A successful function call will clear the Client values and close the webSocket connection - + Allows you to register an Amino account This function requires a verification code, refer to request_verify_code() @@ -146,7 +186,7 @@ - + Allows you to restore an Amino account @@ -155,7 +195,7 @@ - + Allows you to delete the current Amino account This function requires a verification code, refer to request_verify_code() @@ -181,7 +221,7 @@ - + Allows you to change the password of the current Amino account @@ -632,11 +672,84 @@ + + + Allows you to get information about an Amino Invite Code + + + Obejct : Amino.Objects.FromInvite + + + + Allows you to change the wallet config of the current Amino account + + + + + + + Allows you to get a list of available Avatar Frames of the current Amino account + + + + List : Amino.Object.AvatarFrame + Handles the Event calls, do not manually interact with this Class or its functions! + + + This class is responsible for all Events of Amino.Net + + + + + This function handles the websocket responses and converts them into objects to call events with + + + + + + + + This value represents the baseURL to Aminos REST backend + + + + + This function allows you to generate an Amino valid signiture based on JSON data + + + string : The signiture. + + + + This function allows you to generate an Amino valid signiture for file uploads + + + string : The signiture. + + + + This function allows you to generate an Amino valid device ID + + string : The Device ID + + + + This function allows you to get the current UNIX Timestamp (NOT Amino valid) + + double : The current UNIX Timestamp + + + + This function allows you to get the Type ID based on Amino.Types.Object_Types + + + int : the object ID index thingie + Account gender properties diff --git a/Amino.NET/Client.cs b/Amino.NET/Client.cs index 0746941..62aa562 100644 --- a/Amino.NET/Client.cs +++ b/Amino.NET/Client.cs @@ -87,7 +87,6 @@ public class Client //The value to access the websocket manager private Amino.WebSocketHandler webSocket; //Events - //public event EventHandler onMessage; /// /// Fires each time an Amino Text Message has been received by the current Amino account /// @@ -100,6 +99,38 @@ public class Client /// Fires each time an Amino WebSocket Message has been receveived by the current Amino Client /// public event Action onWebSocketMessage; + /// + /// Fires each time an Amino YouTube message has been received by the current Amino account + /// + public event Action onYouTubeMessage; + /// + /// Fires each time an Amino Voice message / note has been received by the current Amino account + /// + public event Action onVoiceMessage; + /// + /// Fires each time an Amino Sticker message has been received by the current Amino account + /// + public event Action onStickerMessage; + /// + /// Fires each time an Amino message has been deleted (in a chat where the current Amino account is in) + /// + public event Action onMessageDeleted; + /// + /// Fires each time an Amino member joined a chat where the current Amino account is in + /// + public event Action onChatMemberJoin; + /// + /// Fires each time an Amino member left a chat where the current Amino account is in + /// + public event Action onChatMemberLeave; + /// + /// Fires each time an Amino chat background has changed (only chats where the current Amino account is in) + /// + public event Action onChatBackgroundChanged; + /// + /// Fires each time an Amino chat title has been changed (only chats where the current Amino account is in) + /// + public event Action onChatTitleChanged; //headers. private IDictionary headers = new Dictionary(); @@ -111,9 +142,10 @@ private Task headerBuilder() headers.Add("NDCDEVICEID", deviceID); headers.Add("Accept-Language", "en-US"); headers.Add("Content-Type", "application/json; charset=utf-8"); - headers.Add("Host", "service.narvii.com"); + headers.Add("Host", "service.aminoapps.com"); headers.Add("Accept-Encoding", "gzip"); headers.Add("Connection", "Keep-Alive"); + headers.Add("User-Agent", "Dalvik/2.1.0 (Linux; U; Android 7.1.2; SM-G965N Build/star2ltexx-user 7.1.; com.narvii.amino.master/3.4.33602)"); if(sessionID != null) { headers.Add("NDCAUTH", $"sid={sessionID}"); } return Task.CompletedTask; } @@ -2312,6 +2344,69 @@ public void callImageMessageEvent(Amino.Client _client, Amino.Objects.ImageMessa _client.onImageMessage.Invoke(_image); } } + + public void callYouTubeMessageEvent(Amino.Client _client, Amino.Objects.YouTubeMessage _youtubeMessage) + { + if(_client.onYouTubeMessage != null) + { + _client.onYouTubeMessage.Invoke(_youtubeMessage); + } + } + + public void callVoiceMessageEvent(Amino.Client _client, Amino.Objects.VoiceMessage _voiceMessage) + { + if(_client.onVoiceMessage != null) + { + _client.onVoiceMessage.Invoke(_voiceMessage); + } + } + + public void callStickerMessageEvent(Amino.Client _client, Amino.Objects.StickerMessage _stickerMessage) + { + if(_client.onStickerMessage != null) + { + _client.onStickerMessage.Invoke(_stickerMessage); + } + } + + public void callMessageDeletedEvent(Amino.Client _client, Amino.Objects.DeletedMessage _deletedMessage) + { + if(_client.onMessageDeleted != null) + { + _client.onMessageDeleted.Invoke(_deletedMessage); + } + } + + public void callChatMemberJoinEvent(Amino.Client _client, Amino.Objects.JoinedChatMember _joinedMember) + { + if(_client.onChatMemberJoin != null) + { + _client.onChatMemberJoin.Invoke(_joinedMember); + } + } + + public void callChatMemberLeaveEvent(Amino.Client _client, Amino.Objects.LeftChatMember _leftMember) + { + if(_client.onChatMemberLeave != null) + { + _client.onChatMemberLeave.Invoke(_leftMember); + } + } + + public void callChatBackgroundChangedEvent(Amino.Client _client, Amino.Objects.ChatEvent _chatEvent) + { + if(_client.onChatBackgroundChanged != null) + { + _client.onChatBackgroundChanged.Invoke(_chatEvent); + } + } + public void callChatTitleChangedEvent(Amino.Client _client, Amino.Objects.ChatEvent _chatEvent) + { + if(_client.onChatTitleChanged != null) + { + _client.onChatTitleChanged.Invoke(_chatEvent); + } + } } } } diff --git a/Amino.NET/Events/EventHandler.cs b/Amino.NET/Events/EventHandler.cs index 094360c..bfc342e 100644 --- a/Amino.NET/Events/EventHandler.cs +++ b/Amino.NET/Events/EventHandler.cs @@ -8,8 +8,17 @@ namespace Amino.Events { + /// + /// This class is responsible for all Events of Amino.Net + /// public class EventHandler { + /// + /// This function handles the websocket responses and converts them into objects to call events with + /// + /// + /// + /// public Task ReceiveEvent(JObject webSocketMessage, Client client) { Client.Events eventCall = new Client.Events(); @@ -21,14 +30,52 @@ public Task ReceiveEvent(JObject webSocketMessage, Client client) { switch((int)jsonObj["o"]["chatMessage"]["mediaType"]) { - case 0: //TextMessage - Amino.Objects.Message _message = new Amino.Objects.Message(webSocketMessage); - eventCall.callMessageEvent(client, this, _message); + case 0: //TextMessage / MessageDeleted / ChatMember Left, ChatMember Joined / ChatBackground changed / ChatTitle changed + switch((int)jsonObj["o"]["chatMessage"]["type"]) + { + case 0: //Textmessage recevied + Amino.Objects.Message _message = new Amino.Objects.Message(webSocketMessage); + eventCall.callMessageEvent(client, this, _message); + break; + case 100: // Textmessage deleted + Amino.Objects.DeletedMessage _deletedMessage = new Objects.DeletedMessage(webSocketMessage); + eventCall.callMessageDeletedEvent(client, _deletedMessage); + break; + case 101: // ChatMember Joined + Amino.Objects.JoinedChatMember _joinedMember = new Objects.JoinedChatMember(webSocketMessage); + eventCall.callChatMemberJoinEvent(client, _joinedMember); + break; + case 102: // ChatMember Left + Amino.Objects.LeftChatMember _leftMember = new Objects.LeftChatMember(webSocketMessage); + eventCall.callChatMemberLeaveEvent(client, _leftMember); + break; + case 104: // ChatBackground changed + Amino.Objects.ChatEvent _chatBackgroundChanged = new Objects.ChatEvent(webSocketMessage); + eventCall.callChatBackgroundChangedEvent(client, _chatBackgroundChanged); + break; + case 105: // ChatTitle changed + Amino.Objects.ChatEvent _chatTitleChanged = new Objects.ChatEvent(webSocketMessage); + eventCall.callChatTitleChangedEvent(client, _chatTitleChanged); + break; + } + break; case 100: //ImageMessage Amino.Objects.ImageMessage _imageMessage = new Amino.Objects.ImageMessage(webSocketMessage); eventCall.callImageMessageEvent(client, _imageMessage); break; + case 103: //YouTubeMessage + Amino.Objects.YouTubeMessage _youtubeMessage = new Objects.YouTubeMessage(webSocketMessage); + eventCall.callYouTubeMessageEvent(client, _youtubeMessage); + break; + case 110: //VoiceMessage + Amino.Objects.VoiceMessage _voiceMessage = new Objects.VoiceMessage(webSocketMessage); + eventCall.callVoiceMessageEvent(client, _voiceMessage); + break; + case 113: //StickerMessage + Amino.Objects.StickerMessage _stickerMessage = new Objects.StickerMessage(webSocketMessage); + eventCall.callStickerMessageEvent(client, _stickerMessage); + break; } } } diff --git a/Amino.NET/Objects/ChatEvent.cs b/Amino.NET/Objects/ChatEvent.cs new file mode 100644 index 0000000..9382200 --- /dev/null +++ b/Amino.NET/Objects/ChatEvent.cs @@ -0,0 +1,45 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class ChatEvent + { + 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 ChatEvent(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(); + } + } +} diff --git a/Amino.NET/Objects/DeletedMessage.cs b/Amino.NET/Objects/DeletedMessage.cs new file mode 100644 index 0000000..729072a --- /dev/null +++ b/Amino.NET/Objects/DeletedMessage.cs @@ -0,0 +1,119 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class DeletedMessage + { + 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 DeletedMessage(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); + + } + + [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"]["iconUrl"]; + 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/JoinedChatMember.cs b/Amino.NET/Objects/JoinedChatMember.cs new file mode 100644 index 0000000..eca3833 --- /dev/null +++ b/Amino.NET/Objects/JoinedChatMember.cs @@ -0,0 +1,118 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class JoinedChatMember + { + 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 JoinedChatMember(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); + } + + + [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"]; + 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/LeftChatMember.cs b/Amino.NET/Objects/LeftChatMember.cs new file mode 100644 index 0000000..fb4200c --- /dev/null +++ b/Amino.NET/Objects/LeftChatMember.cs @@ -0,0 +1,46 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class LeftChatMember + { + 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 LeftChatMember(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(); + + } + } +} diff --git a/Amino.NET/Objects/StickerMessage.cs b/Amino.NET/Objects/StickerMessage.cs new file mode 100644 index 0000000..db70a29 --- /dev/null +++ b/Amino.NET/Objects/StickerMessage.cs @@ -0,0 +1,203 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class StickerMessage + { + public int _type { get; } + public int communityId { get; } + public int alertOption { get; } + public int membershipStatus { get; } + + public string mediaValue { 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 chatBubbleId { get; } + public int chatBubbleVersion { get; } + public string json { get; } + public _Author Author { get; } + public _Extensions Extensions { get; } + + public StickerMessage(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"]; + + + mediaValue = (string)jsonObj["o"]["chatMessage"]["mediaValue"]; + 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"]; + chatBubbleId = (string)jsonObj["o"]["chatMessage"]["chatBubbleId"]; + chatBubbleVersion = (int)jsonObj["o"]["chatMessage"]["chatBubbleVersion"]; + if (jsonObj["o"]["chatMessage"]["author"] != null) { Author = new _Author(_json); } + if (jsonObj["o"]["chatMessage"]["extensions"] != null) { Extensions = new _Extensions(_json); } + } + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _Extensions + { + public string originalStickerId { get; } + public _Sticker Sticker { get; } + + public _Extensions(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + originalStickerId = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["originalStickerId"]; + Sticker = new _Sticker(_json); + } + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _Sticker + { + public int status { get; } + public string iconV2Url { get; } + public string stickerId { get; } + public string smallIconV2Url { get; } + public string smallIconUrl { get; } + public string stickerCollectionId { get; } + public string mediumIconUrl { get; } + public int usedCount { get; } + public string mediumIconV2Url { get; } + public string createdTime { get; } + public string iconUrl { get; } + public _StickerCollectionSummary StickerCollectionSummary { get; } + + + public _Sticker(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + status = (int)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["status"]; + iconV2Url = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["iconV2"]; + stickerId = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerId"]; + smallIconV2Url = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["smallIconV2"]; + smallIconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["smallIcon"]; + stickerCollectionId = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionId"]; + mediumIconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["mediumIcon"]; + usedCount = (int)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["usedCount"]; + mediumIconV2Url = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["mediumIconV2"]; + createdTime = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["createdTime"]; + iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["icon"]; + StickerCollectionSummary = new _StickerCollectionSummary(_json); + } + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _StickerCollectionSummary + { + public int status { get; } + public int collectionType { get; } + public string userId { get; } + public string modifiedTime { get; } + public string smallIconUrl { get; } + public int usedCount { get; } + public string iconUrl { get; } + public string name { get; } + public string collectionId { get; } + public string createdTime { get; } + + public _StickerCollectionSummary(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + status = (int)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionSummary"]["status"]; + collectionType = (int)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionSummary"]["collectionType"]; + userId = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionSummary"]["uid"]; + modifiedTime = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionSummary"]["modifiedTime"]; + smallIconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionSummary"]["smallIcon"]; + usedCount = (int)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionSummary"]["usedCount"]; + iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionSummary"]["icon"]; + name = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionSummary"]["name"]; + collectionId = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionSummary"]["collectionId"]; + createdTime = (string)jsonObj["o"]["chatMessage"]["author"]["extensions"]["sticker"]["stickerCollectionSummary"]["createdTime"]; + } + } + } + } + + [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/VoiceMessage.cs b/Amino.NET/Objects/VoiceMessage.cs new file mode 100644 index 0000000..d405ffa --- /dev/null +++ b/Amino.NET/Objects/VoiceMessage.cs @@ -0,0 +1,135 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class VoiceMessage + { + public int _type { get; } + public int communityId { get; } + public int alertOption { get; } + public int membershipStatus { get; } + + public string mediaValue { 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 VoiceMessage(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"]; + + mediaValue = (string)jsonObj["o"]["chatMessage"]["mediaValue"]; + 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(); + if(jsonObj["o"]["chatMessage"]["extensions"] != null) { Extensions = new _Extensions(_json); } + 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 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 float duration { get; } + + public _Extensions(JObject _json) + { + dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); + duration = (float)jsonObj["o"]["chatMessage"]["extensions"]["duration"]; + } + } + } +} diff --git a/Amino.NET/Objects/YouTubeMessage.cs b/Amino.NET/Objects/YouTubeMessage.cs new file mode 100644 index 0000000..72f615b --- /dev/null +++ b/Amino.NET/Objects/YouTubeMessage.cs @@ -0,0 +1,124 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Amino.Objects +{ + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class YouTubeMessage + { + public int _type { get; } + public int alertOption { get; } + public int membershipStatus { get; } + public int communityId { get; } + + public string mediaValue { get; } + public string chatId { get; } + public int mediaType { get; } + public string videoTitle { 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 chatBubbleId { get; } + public int chatBubbleVersion { get; } + public string json { get; } + public _Author Author { get; } + + + public YouTubeMessage(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"]; + + mediaValue = (string)jsonObj["o"]["chatMessage"]["mediaValue"]; + chatId = (string)jsonObj["o"]["chatMessage"]["threadId"]; + videoTitle = (string)jsonObj["o"]["chatMessage"]["content"]; + clientRefId = (int)jsonObj["o"]["chatMessage"]["clientRefId"]; + messageId = (string)jsonObj["o"]["chatMessage"]["messageId"]; + userId = (string)jsonObj["o"]["chatMessage"]["userId"]; + createdTime = (string)jsonObj["o"]["chatMessage"]["createdTime"]; + type = (int)jsonObj["o"]["chatMessage"]["type"]; + isHidden = (bool)jsonObj["o"]["chatMessage"]["isHidden"]; + includedInSummary = (bool)jsonObj["o"]["chatMessage"]["includedInSummary"]; + chatBubbleId = (string)jsonObj["o"]["chatMessage"]["chatBubbleId"]; + chatBubbleVersion = (int)jsonObj["o"]["chatMessage"]["chatBubbleVersion"]; + Author = new _Author(_json); + json = _json.ToString(); + + } + + [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] + public class _Author + { + public string userId { get; } + public int status { get; } + public string iconUrl { get; } + public int reputationn { 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"]; } + reputationn = (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/helpers.cs b/Amino.NET/helpers.cs index ade5d32..fd3accc 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 = "42"; - string key = "f8e7a61ac3f725941e3ac7cae2d688be97f30b93"; + string prefix = "52"; + string key = "EAB4F1B9E3340CD1631EDE3B587CC3EBEDF1AFA9".ToLower(); HMACSHA1 hmac = new HMACSHA1(StringToByteArray(key)); byte[] buffer = Encoding.Default.GetBytes(data); @@ -55,8 +55,8 @@ public static string generate_signiture(string data) /// string : The signiture. public static string generate_file_signiture(byte[] data) { - string prefix = "42"; - string key = "f8e7a61ac3f725941e3ac7cae2d688be97f30b93"; + string prefix = "52"; + string key = "EAB4F1B9E3340CD1631EDE3B587CC3EBEDF1AFA9".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 = "42"; - string key = "02b258c63559d8804321c5d5065af320358d366f"; + string prefix = "52"; + string key = "AE49550458D8E7C51D566916B04888BFB8B3CA7D".ToLower(); Random rnd = new Random(); byte[] identifier = new byte[20]; diff --git a/Events.md b/Events.md index f3c703a..a22a652 100644 --- a/Events.md +++ b/Events.md @@ -94,6 +94,229 @@ static void main(string[] args) - string +
+onYouTubeMessage +

This event fires each time a YouTube message has been received by the Client

+ +### Event: +- This event returns an Amino.Objects.YouTubeMessage Object +### Example: +```CSharp +static void onYouTubeMessageEvent(Amino.Objects.YouTubeMessage youtubeMessage) +{ + Console.WriteLine("Video title of the received Video: " + youtubeMessage.videoTitle); +} + + +[...] + +static void main(string[] args) +{ + [...] + client.onYouTubeMessage += onYouTubeMessageEvent; +} +``` + +### Returns: +- Amino.Objects.YouTubeMessage +
+ +
+onVoiceMessage +

This event fires each time a Voice message / note is received by the Client

+ +### Event: +- This event returns an Amino.Objects.VoiceMessage Object +### Example: +```CSharp +static void onVoiceMessageEvent(Amino.Objects.VoiceMessage voiceMessage) +{ + Console.WriteLine("URL to the audio file: " + voiceMessage.mediaValue); + Console.WriteLine("Duration of the voice message: " + voiceMessage.Extensions.duration); +} + + +[...] + +static void main(string[] args) +{ + [...] + client.onVoiceMessage += onVoiceMessageEvent; +} +``` + +### Returns: +- Amino.Objects.VoiceMessage +
+ +
+onStickerMessage +

This event fires each time an Amino sticker message has been received by the Client

+ +### Event: +- This event returns an Amino.Objects.StickerMessage Object +### Example: +```CSharp +static void onStickerMessageEvent(Amino.Objects.StickerMessage stickerMessage) +{ + Console.WriteLine("Sticker ID: " + stickerMessage.Sticker.stickerId); +} + + +[...] + +static void main(string[] args) +{ + [...] + client.onStickerMessage += onStickerMessageEvent; +} +``` + +### Returns: +- Amino.Objects.StickerMessage +
+ + +
+onMessageDeleted +

This event fires each time an Amino message has been deleted in any chat where the current Amino account is in

+ +### Event: +- This even returns an Amino.Objects.DeletedMessage Object +### Example: +```CSharp +static void onDeletedMessageEvent(Amino.Objects.DeletedMessage deletedMessage) +{ + Console.WriteLine($"User: {deletedMessage.Author.username}({deletedMessage.Author.userId}) has deleted a message in chat: {deletedMessage.chatId}"); +} + + +[...] + +static void main(string[] args) +{ + [...] + client.onMessageDeleted += onStickerMessageEvent; +} +``` + +### Returns: +- Amino.Objects.DeletedMessage +
+ + +
+onChatMemberJoin +

This event fires each time an Amino user has joined a chat thread where the current Amino account is in

+ +### Event: +- This event returns an Amino.Obejcts.JoinedChatMember Object + +### Example: +```CSharp +static void onUserChatJoinEvent(Amino.Objects.JoinedChatMember joinedMember) +{ + Console.WriteLine($"User: {joinedMember.Author.nickname} joined chat {joinedMember.chatId}"); +} + + +[...] + +static void main(string[] args) +{ + [...] + client.onChatMemberJoin += onUserChatJoinEvent; +} +``` + +### Returns: +- Amino.Objects.JoinedChatMember +
+ + +
+onChatMemberLeave +

This even fires each time an Amino user has left a chat where the current Amino account is in

+ +### Event: +- This event returns an Amino.Objects.LeftChatMember Object +### Example: +```CSharp +static void onUserChatLeaveEvent(Amino.Objects.LeftChatMember leftMember) +{ + Console.WriteLine($"User: {leftMember.userId} left chat {leftMember.chatId}"); +} + + +[...] + +static void main(string[] args) +{ + [...] + client.onChatMemberLeave += onUserChatLeaveEvent; +} +``` + +### Returns: +- Amino.Objects.LeftChatMember +
+ + +
+onChatBackgroundChanged +

This event fires each time an Amino chat thread background has been changed (only chats where the current Amino account is in)

+ +### Event: +- This event returns an Amino.Objects.ChatEvent Object + +### Example: +```CSharp +static void onChatBackgroundChangedEvent(Amino.Objects.ChatEvent chatEvent) +{ + Console.WriteLine($"Background in Chat thread {chatEvent.chatId} has changed."); +} + + +[...] + +static void main(string[] args) +{ + [...] + client.onChatBackgroundChanged += onChatBackgroundChangedEvent; +} +``` + +### Returns: +- Amino.Objects.ChatEvent +
+ + +
+onChatTitleChanged +

This event fires each time an Amino chat thread Title has been changed (only for chats where the current Amino account is in)

+ +### Event: +- This event returns an Amino.Objects.ChatEvent Object +### Example: +```CSharp +static void onChatTitleChangedEvent(Amino.Objects.ChatEvent chatEvent) +{ + Console.WriteLine($"Title of Chat thread {chatEvent.chatId} has changed."); +} + + +[...] + +static void main(string[] args) +{ + [...] + client.onChatTitleChanged += onChatTitleChangedEvent; +} +``` + +### Returns: +- Amino.Objects.ChatEvent +
\ No newline at end of file diff --git a/README.md b/README.md index 022fd14..24e1f98 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,12 @@ You can get Amino.Net straight from [NuGet.org](https://nuget.org) or any NuGet - Types (Coming soon) - Objects (Coming soon) - Events ([Click Here](https://github.com/FabioGaming/Amino.NET/blob/master/Events.md)) -- Exceptions & Troubleshooting (Coming soon) +- Exceptions & Troubleshooting ([Click Here](https://github.com/FabioGaming/Amino.NET/blob/master/Exceptions.md)) - Amino REST API Documentation (Coming soon) - Official Amino.Net Discord Server ([Click Here](https://discord.gg/gNnBnADQkz)) # GENERAL DOCUMENTATION +### To see a better view on the Documentation consider viewing the seperated documentation files linked in `Quick Links` ## Client The Amino.Client() Object is a crucial object to make Bots or tools, as there need to be an instance of it to make the library work ### Values