Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hopefully fixed send_message #27

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 1 addition & 47 deletions Amino.NET/SubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1155,27 +1155,11 @@ public Objects.Message send_message(string message, string chatId, Types.Message
}
message = message.Replace("<$", "").Replace("$>", "");
JObject data = new JObject();
JObject attachementSub = new JObject();
JObject extensionSub = new JObject();
JObject extensionSuBArray = new JObject();
data.Add("type", (int)messageType);
data.Add("content", message);
data.Add("clientRefId", helpers.GetTimestamp() / 10 % 1000000000);
data.Add("timestamp", helpers.GetTimestamp() * 1000);
attachementSub.Add("objectId", null);
attachementSub.Add("objectType", null);
attachementSub.Add("link", null);
attachementSub.Add("title", null);
attachementSub.Add("content", null);
attachementSub.Add("mediaList", null);
extensionSuBArray.Add("link", null);
extensionSuBArray.Add("mediaType", 100);
extensionSuBArray.Add("mediaUploadValue", null);
extensionSuBArray.Add("mediaUploadValueContentType", "image/jpg");
extensionSub.Add("mentionedArray", new JArray(mentions));
extensionSub.Add("linkSnippetList", new JArray(extensionSuBArray));
data.Add("attachedObject", attachementSub);
data.Add("extensions", extensionSub);
data.Add("extensions", new JObject() { { "mentionedArray", new JArray(mentions) } });
if (replyTo != null) { data.Add("replyMessageId", replyTo); }

RestClient client = new RestClient(helpers.BaseUrl);
Expand All @@ -1192,26 +1176,10 @@ public Objects.Message send_message(string message, string chatId, Types.Message
public Task send_file_message(string chatId, byte[] file, Types.upload_File_Types fileType)
{
JObject data = new JObject();
JObject attachementSub = new JObject();
JObject extensionSub = new JObject();
JObject extensionSuBArray = new JObject();
data.Add("clientRefId", helpers.GetTimestamp() / 10 % 1000000000);
data.Add("timestamp", helpers.GetTimestamp() * 1000);
data.Add("content", null);
data.Add("type", 0);
attachementSub.Add("objectId", null);
attachementSub.Add("objectType", null);
attachementSub.Add("link", null);
attachementSub.Add("title", null);
attachementSub.Add("content", null);
attachementSub.Add("mediaList", null);
extensionSuBArray.Add("link", null);
extensionSuBArray.Add("mediaType", 100);
extensionSuBArray.Add("mediaUploadValue", null);
extensionSuBArray.Add("mediaUploadValueContentType", "image/jpg");
extensionSub.Add("linkSnippetList", new JArray(extensionSuBArray));
data.Add("attachedObject", attachementSub);
data.Add("extensions", extensionSub);

switch (fileType)
{
Expand Down Expand Up @@ -1303,20 +1271,6 @@ public Task send_sticker(string chatId, string stickerId)
data.Add("content", null);
data.Add("clientRefId", helpers.GetTimestamp() / 10 % 1000000000);
data.Add("timestamp", helpers.GetTimestamp() * 1000);
attachementSub.Add("objectId", null);
attachementSub.Add("objectType", null);
attachementSub.Add("link", null);
attachementSub.Add("title", null);
attachementSub.Add("content", null);
attachementSub.Add("mediaList", null);
extensionSuBArray.Add("link", null);
extensionSuBArray.Add("mediaType", 100);
extensionSuBArray.Add("mediaUploadValue", null);
extensionSuBArray.Add("mediaUploadValueContentType", "image/jpg");
extensionSub.Add("mentionedArray", new JArray());
extensionSub.Add("linkSnippetList", new JArray(extensionSuBArray));
data.Add("attachedObject", attachementSub);
data.Add("extensions", extensionSub);
data.Add("stickerId", stickerId);

RestClient client = new RestClient(helpers.BaseUrl);
Expand Down
Loading