Reputation: 17
I'm currently trying to make my JDA Bot write a message if it leaves a voice channel. Then 3 seconds after the message is sent it should follow with another message.
I've already tried to do it with the RestAction but I could only figure out how to delete a message with delay.
The code would look something like this :
channel.sendMessage("You told me to leave, so I left"); //I shortened the message command here
//Then with a delay of 3 seconds it should do this
channel.sendMessage("That was mean");
I hope someone will be able to help me out here. Any help is greatly appreciated!
Upvotes: 0
Views: 1905
Reputation: 6131
Every RestAction has a queueAfter(long, TimeUnit)
which can be used to delay it:
channel.sendMessage("Hello").queueAfter(10, TimeUnit.SECONDS);
Upvotes: 2