Add small delay before shutdown
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Bea 2022-08-26 03:48:15 +02:00
parent ffab94f525
commit 3416c13f10
1 changed files with 8 additions and 3 deletions

View File

@ -10,6 +10,8 @@ import wtf.beatrice.hidekobot.utils.RandomUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class MessageListener extends ListenerAdapter
{
@ -87,15 +89,18 @@ public class MessageListener extends ListenerAdapter
return;
}
if(eventMessage.equalsIgnoreCase("hideko die"))
{
MessageChannel channel = event.getChannel();
channel.sendMessage("Going to sleep! Cya :sparkles:").queue();
HidekoBot.getAPI().shutdown();
System.exit(0);
Executors.newSingleThreadScheduledExecutor().schedule(() ->
{
HidekoBot.getAPI().shutdown();
System.exit(0);
}, 5, TimeUnit.SECONDS);
return;
}
}