// Checks if it's a private message (from user or bot) if (event.isPrivate){ // prints sender id console.log(message.senderId); // read message if (message.text == "hello"){ constsender = awaitmessage.getSender(); console.log("sender is",sender); awaitclient.sendMessage(sender,{ message:`hi your id is ${message.senderId}` }); } } } // adds an event handler for new messages client.addEventHandler(eventPrint, newNewMessage({}));
Occurs whenever a new text message or a message with media arrives.