Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package net.javadiscord.javabot.systems.staff;

import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyAction;
import net.javadiscord.javabot.command.SlashCommandHandler;

/**
* Command that lets staff-members redeploy the bot.
*
* This only works if the way the bot is hosted is set up correctly, for example with a bash script that handles
* compilation and a service set up with that bash script running before the bot gets started.
*
* I have explained how we do it in https://github.com/Java-Discord/JavaBot/pull/195
*/
@Slf4j
public class RedeployCommand implements SlashCommandHandler {
@Override
public ReplyAction handle(SlashCommandEvent event) {
log.warn("Redeploying... Requested by: " + event.getUser().getAsTag());
event.reply("Redeploying... this can take up to 2 Minutes.").queue();
System.exit(0);
return null;
}
}
9 changes: 9 additions & 0 deletions src/main/resources/commands/staff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@
id: moderation.staffRoleId
handler: net.javadiscord.javabot.systems.staff.SayCommand

# /redeploy
- name: redeploy
description: Makes the bot redeploy
enabledByDefault: false
privileges:
- type: ROLE
id: moderation.staffRoleId
handler: net.javadiscord.javabot.systems.staff.redeployCommand

# /kick
- name: kick
description: Kicks a member
Expand Down