boogzey 1 Share Posted August 31, 2018 I have a a bunch of people on my friends list and I want to send private messages to them using the dreambot API. I can't find anything relevant on the docs. How can I loop over my friend's list and send them each a message? Link to comment Share on other sites More sharing options...
7804364 230 Share Posted August 31, 2018 This might work, Arrays.asList(getFriends().getFriends()).forEach(f -> { WidgetChild friendsWidget = getWidgets().getWidgetChild(429, 11); for (WidgetChild wc : friendsWidget.getChildren()) { if (wc != null) { if (wc.getText().equals(f.getName())) { if (wc.interact()) { getKeyboard().type("This is a message"); } } } } }); Link to comment Share on other sites More sharing options...
None 227 Share Posted August 31, 2018 public class SendPm { private boolean sendToMule(String message) { if (!getTabs().isOpen(Tab.FRIENDS)) { getTabs().open(Tab.FRIENDS); sleep(seededRandom(400, 400)); } WidgetChild friendsList = getWidgets().getWidgetChild(429, 3); WidgetChild[] friends = friendsList.getChildren(); for (WidgetChild wc : friends) { if (wc.getText().contains(muleName)) { if (wc.interact()) { sleepUntil(() -> getDialogues().canEnterInput(), 5000); getKeyboard().type(message, true); return true; } } } return false; } } this is old so you will need to check the widget id.. credit to Nezz i think? snippit i collected like a year ago Link to comment Share on other sites More sharing options...
boogzey 1 Author Share Posted August 31, 2018 11 hours ago, 7804364 said: This might work, Arrays.asList(getFriends().getFriends()).forEach(f -> { WidgetChild friendsWidget = getWidgets().getWidgetChild(429, 11); for (WidgetChild wc : friendsWidget.getChildren()) { if (wc != null) { if (wc.getText().equals(f.getName())) { if (wc.interact()) { getKeyboard().type("This is a message"); } } } } }); This works, but I'm using it like this: private void SendMessage(){ try { getTabs().openWithMouse(Tab.FRIENDS); Arrays.asList(getFriends().getFriends()).forEach(f -> { WidgetChild friendsWidget = getWidgets().getWidgetChild(429, 11); for (WidgetChild wc : friendsWidget.getChildren()) { if (wc != null) { wc.interact("Message"); getKeyboard().type("This is a message"); } } }); } catch(Exception e){ log(e.toString()); } } However, it doesn't scroll through my friends list at all. How can I make that happen? Thanks for the help btw. Link to comment Share on other sites More sharing options...
Bell 9 Share Posted November 17, 2018 There are also many different ways with 3rd party APIs that will just talk to each other Link to comment Share on other sites More sharing options...
kamilo 7 Share Posted October 29, 2019 On 11/17/2018 at 5:14 PM, Bell said: There are also many different ways with 3rd party APIs that will just talk to each other elaborate Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.