使JDA Discord Bot延迟写入消息

时间:2020-01-25 21:36:26

标签: bots delay discord discord-jda

我目前正在尝试让JDA Bot留下一条语音通道来编写一条消息。邮件发送后3秒钟,应该再显示一条消息。

我已经尝试使用RestAction来做到这一点,但我只能弄清楚如何延迟删除一条消息。

代码看起来像这样:

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");

我希望有人能够在这里帮助我。任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:2)

每个RestAction都有一个queueAfter(long, TimeUnit)可以用来延迟它:

channel.sendMessage("Hello").queueAfter(10, TimeUnit.SECONDS);