Skip to content

Commit 0cdc9d7

Browse files
committed
Fixed #30
[ # ] Fixed issue #30, it should no longer be trying to duplicate the JSON key [ # ] Also updated send_message and such on Client class as it was still running on the old model
1 parent be91f42 commit 0cdc9d7

3 files changed

Lines changed: 4 additions & 34 deletions

File tree

Amino.NET/Amino.NET.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net7.0</TargetFramework>
5-
<Version>1.5.2</Version>
5+
<Version>1.7.0</Version>
66
<Authors>FabioTheFox</Authors>
77
<Company>FabiDev</Company>
88
<Description>An unofficial C# wrapper for Aminos REST API for making amino bots and tools</Description>

Amino.NET/Client.cs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,27 +2265,11 @@ public Objects.Message send_message(string message, string chatId, Types.Message
22652265
}
22662266
message = message.Replace("<$", "").Replace("$>", "");
22672267
JObject data = new JObject();
2268-
JObject attachementSub = new JObject();
2269-
JObject extensionSub = new JObject();
2270-
JObject extensionSuBArray = new JObject();
22712268
data.Add("type", (int)messageType);
22722269
data.Add("content", message);
22732270
data.Add("clientRefId", helpers.GetTimestamp() / 10 % 1000000000);
22742271
data.Add("timestamp", helpers.GetTimestamp() * 1000);
2275-
attachementSub.Add("objectId", null);
2276-
attachementSub.Add("objectType", null);
2277-
attachementSub.Add("link", null);
2278-
attachementSub.Add("title", null);
2279-
attachementSub.Add("content", null);
2280-
attachementSub.Add("mediaList", null);
2281-
extensionSuBArray.Add("link", null);
2282-
extensionSuBArray.Add("mediaType", 100);
2283-
extensionSuBArray.Add("mediaUploadValue", null);
2284-
extensionSuBArray.Add("mediaUploadValueContentType", "image/jpg");
2285-
extensionSub.Add("mentionedArray", new JArray(mentions));
2286-
extensionSub.Add("linkSnippetList", new JArray(extensionSuBArray));
2287-
data.Add("attachedObject", attachementSub);
2288-
data.Add("extensions", extensionSub);
2272+
data.Add("extensions", new JObject() { { "mentionedArray", new JArray(mentions) } });
22892273
if (replyTo != null) { data.Add("replyMessageId", replyTo); }
22902274

22912275
RestClient client = new RestClient(helpers.BaseUrl);
@@ -2310,26 +2294,10 @@ public Objects.Message send_message(string message, string chatId, Types.Message
23102294
public Task send_file_message(string chatId, byte[] file, Types.upload_File_Types fileType)
23112295
{
23122296
JObject data = new JObject();
2313-
JObject attachementSub = new JObject();
2314-
JObject extensionSub = new JObject();
2315-
JObject extensionSuBArray = new JObject();
23162297
data.Add("clientRefId", helpers.GetTimestamp() / 10 % 1000000000);
23172298
data.Add("timestamp", helpers.GetTimestamp() * 1000);
23182299
data.Add("content", null);
23192300
data.Add("type", 0);
2320-
attachementSub.Add("objectId", null);
2321-
attachementSub.Add("objectType", null);
2322-
attachementSub.Add("link", null);
2323-
attachementSub.Add("title", null);
2324-
attachementSub.Add("content", null);
2325-
attachementSub.Add("mediaList", null);
2326-
extensionSuBArray.Add("link", null);
2327-
extensionSuBArray.Add("mediaType", 100);
2328-
extensionSuBArray.Add("mediaUploadValue", null);
2329-
extensionSuBArray.Add("mediaUploadValueContentType", "image/jpg");
2330-
extensionSub.Add("linkSnippetList", new JArray(extensionSuBArray));
2331-
data.Add("attachedObject", attachementSub);
2332-
data.Add("extensions", extensionSub);
23332301

23342302
switch (fileType)
23352303
{
@@ -2344,6 +2312,7 @@ public Task send_file_message(string chatId, byte[] file, Types.upload_File_Type
23442312
data.Add("enableUhqEnabled", true);
23452313
break;
23462314
case Types.upload_File_Types.Audio:
2315+
data.Remove("type");
23472316
data.Add("type", 2);
23482317
data.Add("mediaType", 110);
23492318
break;

Amino.NET/SubClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,7 @@ public Task send_file_message(string chatId, byte[] file, Types.upload_File_Type
11941194
data.Add("enableUhqEnabled", true);
11951195
break;
11961196
case Types.upload_File_Types.Audio:
1197+
data.Remove("type");
11971198
data.Add("type", 2);
11981199
data.Add("mediaType", 110);
11991200
break;

0 commit comments

Comments
 (0)