Skip to content

Commit d064d52

Browse files
committed
Add clearMessage method
- It is now possible to delete a message for yourself - WhatsApp Web Version got bumped up to 2,2035,14
1 parent 7225c25 commit d064d52

File tree

13 files changed

+14
-5
lines changed

13 files changed

+14
-5
lines changed
630 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
1 Byte
Binary file not shown.
123 Bytes
Binary file not shown.
123 Bytes
Binary file not shown.
624 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
1 Byte
Binary file not shown.

build/libs/WhatsJava-all.jar

256 Bytes
Binary file not shown.

src/main/java/icu/jnet/whatsjava/WAClient.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,20 @@ private void confirmLogin() {
152152
listener.onReceiveLoginResponse(200);
153153
}
154154

155-
// Generic text message
155+
// Send generic text message
156156
public void sendMessage(String remoteJid, String messageContent) {
157157
String json = WAMessage.buildJson(remoteJid, messageContent, true, Instant.now().getEpochSecond());
158158
sendBinary(json, WAMetric.message, WAFlag.ignore);
159159
}
160160

161+
// Delete the send message only for you
162+
public void clearMessage(String remoteJid, String messageId, boolean owner) {
163+
String modTag = Math.round(Math.random() * 1000000) + "";
164+
sendBinary("[\"action\", {epoch: \"" + Utils.getMessageCount() + "\", type: \"set\"}, "
165+
+ "[[\"chat\", {jid: \"" + remoteJid + "\", modify_tag: \"" + modTag +"\", type: \"clear\"}, "
166+
+ "[[\"item\", {owner: \"" + owner + "\", index: \"" + messageId +"\"}, null]]]]]", WAMetric.group, WAFlag.ignore);
167+
}
168+
161169
// Load the last x messages of a direct chat or group
162170
public void loadConversation(String remoteJid, int messageCount) {
163171
sendBinary("[\"query\", {type: \"message\", epoch: \"" + Utils.getMessageCount() + "\", jid: \"" + remoteJid + "\", "

0 commit comments

Comments
 (0)