Skip to content
nutmeg edited this page Feb 22, 2023 · 3 revisions

Run Down

Sleep allows you to create short delays in your code either with seconds or milliseconds

Sleep

Sleep sleeps for seconds
The call for sleep is PSClient.sleep() and this is how it's setup:

// async is required for it to work
PSClient.command( {name: "sleep"}, async (ctx, cmd) => {
    ctx.channel.send("This message is sent first then it'll wait for 3 seconds");

    await PSClient.sleep(3);

    ctx.channel.send("Then it'll send this one after the 3 seconds is up");
});

SleepMs

SleepMs sleeps for milliseconds
The call for sleepMs is PSClient.sleepMs() and this is how it's setup:

// async is required for it to work
PSClient.command( {name: "sleepMs"}, async (ctx, cmd) => {
    ctx.channel.send("This message is sent first then it'll wait for 3 seconds");

    await PSClient.sleepMs(3000);

    ctx.channel.send("Then it'll send this one after the 3 seconds is up");
});
Clone this wiki locally