Add pause command to halt processing
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Useful for now since I have two instances of the bot running in the same servers and I don't want both of them to respond.
This commit is contained in:
parent
2443adfccc
commit
a18b34b784
@ -5,6 +5,7 @@ public class Configuration
|
|||||||
|
|
||||||
|
|
||||||
private static boolean verbose = false;
|
private static boolean verbose = false;
|
||||||
|
private static boolean paused = false;
|
||||||
|
|
||||||
|
|
||||||
public static boolean isVerbose() { return verbose; }
|
public static boolean isVerbose() { return verbose; }
|
||||||
@ -12,4 +13,7 @@ public class Configuration
|
|||||||
// WARNING: verbosity spams the logs a LOT!
|
// WARNING: verbosity spams the logs a LOT!
|
||||||
public static void setVerbose(boolean v) { verbose = v; }
|
public static void setVerbose(boolean v) { verbose = v; }
|
||||||
|
|
||||||
|
public static boolean isPaused() { return paused; }
|
||||||
|
public static void setPaused(boolean p) { paused = p; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import net.dv8tion.jda.api.entities.*;
|
|||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import wtf.beatrice.hidekobot.Configuration;
|
||||||
import wtf.beatrice.hidekobot.HidekoBot;
|
import wtf.beatrice.hidekobot.HidekoBot;
|
||||||
import wtf.beatrice.hidekobot.utils.Logger;
|
import wtf.beatrice.hidekobot.utils.Logger;
|
||||||
import wtf.beatrice.hidekobot.utils.RandomUtil;
|
import wtf.beatrice.hidekobot.utils.RandomUtil;
|
||||||
@ -23,6 +24,21 @@ public class MessageListener extends ListenerAdapter
|
|||||||
{
|
{
|
||||||
String eventMessage = event.getMessage().getContentDisplay();
|
String eventMessage = event.getMessage().getContentDisplay();
|
||||||
|
|
||||||
|
|
||||||
|
if(eventMessage.equalsIgnoreCase("hideko pause"))
|
||||||
|
{
|
||||||
|
MessageChannel channel = event.getChannel();
|
||||||
|
|
||||||
|
boolean paused = Configuration.isPaused();
|
||||||
|
String msg = paused ? ":white_check_mark: Resuming normal activity!" : ":pause_button: Pausing!";
|
||||||
|
Configuration.setPaused(!paused);
|
||||||
|
channel.sendMessage(msg).queue();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Configuration.isPaused()) return;
|
||||||
|
|
||||||
if(eventMessage.equalsIgnoreCase("hideko"))
|
if(eventMessage.equalsIgnoreCase("hideko"))
|
||||||
{
|
{
|
||||||
MessageChannel channel = event.getChannel();
|
MessageChannel channel = event.getChannel();
|
||||||
|
Loading…
Reference in New Issue
Block a user