Skip to content

Commit

Permalink
Changes on sendMessage structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Darker935 committed May 20, 2024
1 parent 1316682 commit 10002c5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main/java/it/auties/whatsapp/api/Whatsapp.java
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,7 @@ public CompletableFuture<? extends MessageInfo> sendNewsletterMessage(JidProvide
* @return a CompletableFuture
*/
public CompletableFuture<? extends MessageInfo> sendMessage(JidProvider chat, ContextualMessage<?> message, MessageInfo quotedMessage) {
var contextInfo = ContextInfo.of(quotedMessage);
message.setContextInfo(contextInfo);
message.contextInfo().ifPresentOrElse(contextInfo -> message.setContextInfo(ContextInfo.of(contextInfo, quotedMessage)), () -> message.setContextInfo(ContextInfo.of(quotedMessage)));
return sendMessage(chat, MessageContainer.of(message));
}

Expand All @@ -517,8 +516,7 @@ public CompletableFuture<? extends MessageInfo> sendMessage(JidProvider chat, Co
* @return a CompletableFuture
*/
public CompletableFuture<ChatMessageInfo> sendChatMessage(JidProvider chat, ContextualMessage<?> message, MessageInfo quotedMessage) {
var contextInfo = ContextInfo.of(quotedMessage);
message.setContextInfo(contextInfo);
message.contextInfo().ifPresentOrElse(contextInfo -> message.setContextInfo(ContextInfo.of(contextInfo, quotedMessage)), () -> message.setContextInfo(ContextInfo.of(quotedMessage)));
return sendChatMessage(chat, MessageContainer.of(message));
}

Expand All @@ -532,8 +530,7 @@ public CompletableFuture<ChatMessageInfo> sendChatMessage(JidProvider chat, Cont
* @return a CompletableFuture
*/
public CompletableFuture<NewsletterMessageInfo> sendNewsletterMessage(JidProvider chat, ContextualMessage<?> message, MessageInfo quotedMessage) {
var contextInfo = ContextInfo.of(quotedMessage);
message.setContextInfo(contextInfo);
message.contextInfo().ifPresentOrElse(contextInfo -> message.setContextInfo(ContextInfo.of(contextInfo, quotedMessage)), () -> message.setContextInfo(ContextInfo.of(quotedMessage)));
return sendNewsletterMessage(chat, MessageContainer.of(message));
}

Expand Down

0 comments on commit 10002c5

Please sign in to comment.