Skip to content

Commit

Permalink
Merge pull request #47 from Amino-NET-Group/dev
Browse files Browse the repository at this point in the history
Get Ready for 1.7.0
  • Loading branch information
FabioGaming authored Jun 4, 2024
2 parents 6599f01 + 3a4a900 commit e6101ee
Show file tree
Hide file tree
Showing 103 changed files with 2,372 additions and 5,081 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-autopublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Determine version
id: version
run: echo "::set-output name=version::0.$((${GITHUB_RUN_NUMBER} / 10)).$((${GITHUB_RUN_NUMBER} % 10))"
run: echo "::set-output name=version::$((GITHUB_RUN_NUMBER / 100)).$(((GITHUB_RUN_NUMBER % 100) / 10)).$((GITHUB_RUN_NUMBER % 10))"

- name: Get Project Version
id: base_version
Expand Down
467 changes: 467 additions & 0 deletions Amino.NET/ACMClient.cs

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Amino.NET/Amino.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Version>1.5.2</Version>
<Version>1.7.0</Version>
<Authors>FabioTheFox</Authors>
<Company>FabiDev</Company>
<Description>An unofficial C# wrapper for Aminos REST API for making amino bots and tools</Description>
Expand All @@ -22,6 +22,7 @@
<SignAssembly>true</SignAssembly>
<Copyright>FabioTheFox</Copyright>
<Title>Amino.NET</Title>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -38,6 +39,10 @@
</ItemGroup>

<ItemGroup>
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="Amino.Net-Logo-V2.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
Expand Down
2 changes: 1 addition & 1 deletion Amino.NET/Builders/PostBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.IO;
using System.Reflection.Metadata.Ecma335;

namespace Amino.NET.Builders
namespace Amino.Builders
{
public class PostBuilder
{
Expand Down
730 changes: 276 additions & 454 deletions Amino.NET/Client.cs

Large diffs are not rendered by default.

98 changes: 68 additions & 30 deletions Amino.NET/Events/EventHandler.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Amino.Objects;


namespace Amino.Events
{
Expand All @@ -19,98 +16,139 @@ public class EventHandler
/// <param name="webSocketMessage"></param>
/// <param name="client"></param>
/// <returns></returns>
public Task ReceiveEvent(JObject webSocketMessage, Client client)
public Task ReceiveEvent(string webSocketMessage, Client client)
{
Client.Events eventCall = new Client.Events();
eventCall.callWebSocketMessageEvent(client, webSocketMessage);
try
{
dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(webSocketMessage.ToString());
if(jsonObj["o"]["chatMessage"]["mediaType"] != null)
JsonElement root = JsonDocument.Parse(webSocketMessage.ToString()).RootElement;
if(root.GetProperty("o").GetProperty("chatMessage").GetProperty("mediaType").ValueKind != JsonValueKind.Null)
{
switch((int)jsonObj["o"]["chatMessage"]["mediaType"])
SocketBase _socketBase = JsonSerializer.Deserialize<SocketBase>(root.GetProperty("o").GetRawText());
string element = root.GetProperty("o").GetProperty("chatMessage").GetRawText();
switch (root.GetProperty("o").GetProperty("chatMessage").GetProperty("mediaType").GetInt32())
{
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"])
switch(root.GetProperty("o").GetProperty("chatMessage").GetProperty("type").GetInt32())
{
case 0: //Textmessage recevied
Amino.Objects.Message _message = new Amino.Objects.Message(webSocketMessage);
Objects.Message _message = JsonSerializer.Deserialize<Message>(element);
_message.Json = webSocketMessage;
_message.SocketBase = _socketBase;

eventCall.callMessageEvent(client, this, _message);
break;
case 100: // Textmessage deleted
Amino.Objects.DeletedMessage _deletedMessage = new Objects.DeletedMessage(webSocketMessage);
Amino.Objects.DeletedMessage _deletedMessage = JsonSerializer.Deserialize<DeletedMessage>(element);
_deletedMessage.SocketBase = _socketBase;
_deletedMessage.Json = webSocketMessage;
eventCall.callMessageDeletedEvent(client, _deletedMessage);
break;
case 101: // ChatMember Joined
Amino.Objects.JoinedChatMember _joinedMember = new Objects.JoinedChatMember(webSocketMessage);
Amino.Objects.JoinedChatMember _joinedMember = JsonSerializer.Deserialize<JoinedChatMember>(element);
_joinedMember.Json = webSocketMessage;
_joinedMember.SocketBase = _socketBase;
eventCall.callChatMemberJoinEvent(client, _joinedMember);
break;
case 102: // ChatMember Left
Amino.Objects.LeftChatMember _leftMember = new Objects.LeftChatMember(webSocketMessage);
Amino.Objects.LeftChatMember _leftMember = JsonSerializer.Deserialize<LeftChatMember>(element);
_leftMember.Json = webSocketMessage;
_leftMember.SocketBase = _socketBase;
eventCall.callChatMemberLeaveEvent(client, _leftMember);
break;
case 104: // ChatBackground changed
Amino.Objects.ChatEvent _chatBackgroundChanged = new Objects.ChatEvent(webSocketMessage);
Amino.Objects.ChatEvent _chatBackgroundChanged = JsonSerializer.Deserialize<ChatEvent>(element);
_chatBackgroundChanged.SocketBase = _socketBase;
_chatBackgroundChanged.Json = webSocketMessage;
eventCall.callChatBackgroundChangedEvent(client, _chatBackgroundChanged);
break;
case 105: // ChatTitle changed
Amino.Objects.ChatEvent _chatTitleChanged = new Objects.ChatEvent(webSocketMessage);
Amino.Objects.ChatEvent _chatTitleChanged = JsonSerializer.Deserialize<ChatEvent>(element);
_chatTitleChanged.SocketBase = _socketBase;
_chatTitleChanged.Json = webSocketMessage;
eventCall.callChatTitleChangedEvent(client, _chatTitleChanged);
break;
case 113: // ChatContent Changed
Amino.Objects.ChatEvent _chatContentChanged = new Objects.ChatEvent(webSocketMessage);
Amino.Objects.ChatEvent _chatContentChanged = JsonSerializer.Deserialize<ChatEvent>(element);
_chatContentChanged.Json = webSocketMessage;
_chatContentChanged.SocketBase = _socketBase;
eventCall.callChatContentChangedEvent(client, _chatContentChanged);
break;
case 119: // MessageForceRemovedByAdmin
Amino.Objects.SpecialChatEvent _messageForceRemovedByAdmin = new Objects.SpecialChatEvent(webSocketMessage);
Amino.Objects.SpecialChatEvent _messageForceRemovedByAdmin = JsonSerializer.Deserialize<SpecialChatEvent>(element);
_messageForceRemovedByAdmin.Json = webSocketMessage;
_messageForceRemovedByAdmin.SocketBase = _socketBase;
eventCall.callMessageForceRemovedByAdminEvent(client, _messageForceRemovedByAdmin);
break;
case 120: // ChatTip
Amino.Objects.ChatTip _chatTip = new Objects.ChatTip(webSocketMessage);
Amino.Objects.ChatTip _chatTip = JsonSerializer.Deserialize<ChatTip>(element);
_chatTip.Json = webSocketMessage;
_chatTip.SocketBase = _socketBase;
eventCall.callChatTipEvent(client, _chatTip);
break;
case 121: // ChatAnnouncementPin
Amino.Objects.ChatAnnouncement _chatAnnouncementPinEvent = new Objects.ChatAnnouncement(webSocketMessage);
Amino.Objects.ChatAnnouncement _chatAnnouncementPinEvent = JsonSerializer.Deserialize<ChatAnnouncement>(element);
_chatAnnouncementPinEvent.Json = webSocketMessage;
_chatAnnouncementPinEvent.SocketBase = _socketBase;
eventCall.callChatPinAnnouncementEvent(client, _chatAnnouncementPinEvent);
break;
case 125: // ChatViewModeOn
Amino.Objects.ViewMode _viewModeOn = new Objects.ViewMode(webSocketMessage);
Amino.Objects.ViewMode _viewModeOn = JsonSerializer.Deserialize<ViewMode>(element);
_viewModeOn.Json = webSocketMessage;
_viewModeOn.SocketBase = _socketBase;
eventCall.callChatViewModeOnEvent(client, _viewModeOn);
break;
case 126: // ChatViewModeOff
Amino.Objects.ViewMode _viewModeOff = new Objects.ViewMode(webSocketMessage);
Amino.Objects.ViewMode _viewModeOff = JsonSerializer.Deserialize<ViewMode>(element);
_viewModeOff.Json = webSocketMessage;
_viewModeOff.SocketBase = _socketBase;
eventCall.callChatViewModeOffEvent(client, _viewModeOff);
break;
case 127: // ChatAnnouncementUnPin
Amino.Objects.ChatEvent _chatAnnouncementUnPin = new Objects.ChatEvent(webSocketMessage);
Amino.Objects.ChatEvent _chatAnnouncementUnPin = JsonSerializer.Deserialize<ChatEvent>(element);
_chatAnnouncementUnPin.Json = webSocketMessage;
_chatAnnouncementUnPin.SocketBase = _socketBase;
eventCall.callChatUnpinAnnouncementEvent(client, _chatAnnouncementUnPin);
break;
case 128: // ChatTipEnabled
Amino.Objects.ChatTipToggle _chatTipEnabled = new Objects.ChatTipToggle(webSocketMessage);
Amino.Objects.ChatTipToggle _chatTipEnabled = JsonSerializer.Deserialize<ChatTipToggle>(element);
_chatTipEnabled.Json = webSocketMessage;
_chatTipEnabled.SocketBase = _socketBase;
eventCall.callChatTipEnabledEvent(client, _chatTipEnabled);
break;
case 129: // ChatTipDisabled
Amino.Objects.ChatTipToggle _chatTipDisabled = new Objects.ChatTipToggle(webSocketMessage);
Amino.Objects.ChatTipToggle _chatTipDisabled = JsonSerializer.Deserialize<ChatTipToggle>(element);
_chatTipDisabled.Json = webSocketMessage;
_chatTipDisabled.SocketBase = _socketBase;
eventCall.callChatTipDisabledEvent(client, _chatTipDisabled);
break;

}

break;
case 100: //ImageMessage
Amino.Objects.ImageMessage _imageMessage = new Amino.Objects.ImageMessage(webSocketMessage);
Amino.Objects.ImageMessage _imageMessage = JsonSerializer.Deserialize<ImageMessage>(element);
_imageMessage.Json = webSocketMessage;
_imageMessage.SocketBase = _socketBase;
eventCall.callImageMessageEvent(client, _imageMessage);
break;
case 103: //YouTubeMessage
Amino.Objects.YouTubeMessage _youtubeMessage = new Objects.YouTubeMessage(webSocketMessage);
Amino.Objects.YouTubeMessage _youtubeMessage = JsonSerializer.Deserialize<YouTubeMessage>(element);
_youtubeMessage.Json = webSocketMessage;
_youtubeMessage.SocketBase = _socketBase;
eventCall.callYouTubeMessageEvent(client, _youtubeMessage);
break;
case 110: //VoiceMessage
Amino.Objects.VoiceMessage _voiceMessage = new Objects.VoiceMessage(webSocketMessage);
Amino.Objects.VoiceMessage _voiceMessage = JsonSerializer.Deserialize<VoiceMessage>(element);
_voiceMessage.Json = webSocketMessage;
_voiceMessage.SocketBase = _socketBase;
eventCall.callVoiceMessageEvent(client, _voiceMessage);
break;
case 113: //StickerMessage
Amino.Objects.StickerMessage _stickerMessage = new Objects.StickerMessage(webSocketMessage);
Amino.Objects.StickerMessage _stickerMessage = JsonSerializer.Deserialize<StickerMessage>(element);
_stickerMessage.Json = webSocketMessage;
_stickerMessage.SocketBase = _socketBase;
eventCall.callStickerMessageEvent(client, _stickerMessage);
break;
}
Expand Down
9 changes: 9 additions & 0 deletions Amino.NET/Objects/AdditionalItemBenefits.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;

namespace Amino.Objects
{
public class AdditionalItemBenefits
{
[JsonPropertyName("firstMonthFreeAminoPlusMembership")] public bool? FirstMonthFreeAminoPlus { get; set; }
}
}
Loading

0 comments on commit e6101ee

Please sign in to comment.