Add small delay before shutdown
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2022-08-26 03:48:15 +02:00
parent ffab94f525
commit 3416c13f10

View File

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