Skip to content

Misc Metods

GodDragoner edited this page Jun 19, 2018 · 4 revisions

Misc

openLinkInBrowser(String url)

Opens a link in the user's browser.

Parameters:

url - The url you want to open

Example:

    sendMessage("Look at this video on ...");
    openLinkInBrowser("http://website.com/....");

sleep(int seconds)

Sleeps the thread for the given duration (basically waits for the given amount of time before continuing with the code).

Parameters:

seconds - The amount of seconds you want to wait before continuing with the following code

Example:

    sendMessage("Rest before you start again");
    sleep(randomInteger(10, 25));

sleep(int amount, String timeUnit)

Sleeps the thread for the given duration (basically waits for the given amount of time before continuing with the code).

Parameters:

amount - The amount of the given time unit you want to wait before continuing with the following code

timeUnit - The time unit

Example:

    sendMessage("Rest before you start again");
    sleep(randomInteger(10, 25), "SECONDS");

wait(int seconds)

Wait for the given duration (basically waits for the given amount of time before continuing with the code). However this allows the thread to be notified internally to continue (for example when a sub sends a message). Only use this when you know what you are doing.

Parameters:

seconds - The amount of seconds you want to wait before continuing with the following code

Example:

    sendMessage("Rest before you start again");
    wait(randomInteger(10, 25));

wait(int amount, String timeUni)

Wait for the given duration (basically waits for the given amount of time before continuing with the code). However this allows the thread to be notified internally to continue (for example when a sub sends a message). Only use this when you know what you are doing.

Parameters:

amount - The amount of the given time unit you want to wait before continuing with the following code

timeUnit - The time unit

Example:

    sendMessage("Rest before you start again");
    wait(randomInteger(10, 25), "SECONDS");