File tree Expand file tree Collapse file tree
java/net/javadiscord/javabot/systems/staff Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments