Skip to content

Commit b3fb64a

Browse files
authored
Merge pull request #195 from Java-Discord/moon/redeploy
Added redeploy command
2 parents ead9807 + 6749e5b commit b3fb64a

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package net.javadiscord.javabot.systems.staff;
2+
3+
import lombok.extern.slf4j.Slf4j;
4+
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
5+
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyAction;
6+
import net.javadiscord.javabot.command.SlashCommandHandler;
7+
8+
/**
9+
* Command that lets staff-members redeploy the bot.
10+
*
11+
* This only works if the way the bot is hosted is set up correctly, for example with a bash script that handles
12+
* compilation and a service set up with that bash script running before the bot gets started.
13+
*
14+
* I have explained how we do it in https://github.com/Java-Discord/JavaBot/pull/195
15+
*/
16+
@Slf4j
17+
public class RedeployCommand implements SlashCommandHandler {
18+
@Override
19+
public ReplyAction handle(SlashCommandEvent event) {
20+
log.warn("Redeploying... Requested by: " + event.getUser().getAsTag());
21+
event.reply("Redeploying... this can take up to 2 Minutes.").queue();
22+
System.exit(0);
23+
return null;
24+
}
25+
}

‎src/main/resources/commands/staff.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@
136136
id: moderation.staffRoleId
137137
handler: net.javadiscord.javabot.systems.staff.SayCommand
138138

139+
# /redeploy
140+
- name: redeploy
141+
description: Makes the bot redeploy
142+
enabledByDefault: false
143+
privileges:
144+
- type: ROLE
145+
id: moderation.staffRoleId
146+
handler: net.javadiscord.javabot.systems.staff.redeployCommand
147+
139148
# /kick
140149
- name: kick
141150
description: Kicks a member

0 commit comments

Comments
 (0)