Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Adding and messaging friends


    boogzey

    Recommended Posts

    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

    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

    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

    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

    • 2 months later...
    • 11 months later...
    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

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.