Closed open-sudo closed 1 year ago
Following code works well:
var whatsapp = Whatsapp.webBuilder()
.newConnection()
.historyLength(WebHistoryLength.ONE_YEAR)
.build()
.addLoggedInListener(api -> {
System.out.printf("Connected: %s%n", api.store().privacySettings());
})
.addNewMessageListener(message -> System.out.println(message.toJson()))
.addContactsListener((api, contacts) -> System.out.printf("Contacts: %s%n", contacts.size()))
.addChatsListener(chats -> System.out.printf("Chats: %s%n", chats.size()))
.addNodeReceivedListener(incoming -> System.out.printf("Received node %s%n", incoming))
.addNodeSentListener(outgoing -> System.out.printf("Sent node %s%n", outgoing))
.addActionListener((action, info) -> System.out.printf("New action: %s, info: %s%n", action, info))
.addSettingListener(setting -> System.out.printf("New setting: %s%n", setting))
.addContactPresenceListener((chat, contact, status) -> System.out.printf("Status of %s changed in %s to %s%n", contact.name(), chat.name(), status.name()))
.addAnyMessageStatusListener((chat, contact, info, status) -> System.out.printf("Message %s in chat %s now has status %s for %s %n", info.id(), info.chatName(), status, contact == null ? null : contact.name()))
.addChatMessagesSyncListener((chat, last) -> System.out.printf("%s now has %s messages: %s%n", chat.name(), chat.messages().size(), !last ? "waiting for more" : "done"))
.addDisconnectedListener(reason -> System.out.printf("Disconnected: %s%n", reason))
.connect()
.join();
System.out.println("Connected");
whatsapp.awaitDisconnection();
System.out.println("Disconnected");
I keep getting the following execption when I run the BanBot example. As soon as I scan the QR code, the below exception pops up. Please help. Version is 3.3.1 and OS is ubunu 22 with openjdk version "17.0.6" 2023-01-17.
My code is below: