Skip to content

Commit

Permalink
Purge war rooms (planning)
Browse files Browse the repository at this point in the history
  • Loading branch information
xdnw committed May 4, 2024
1 parent 7184e7e commit 6dd2944
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public CommandManager2 registerDefaults() {
getCommands().registerMethod(new IACommands(), List.of("interview", "questions"), "setInterview", "set");
getCommands().registerMethod(new AdminCommands(), List.of("admin", "sync"), "syncWars", "wars");
getCommands().registerMethod(new WarCommands(), List.of("war", "room"), "warRoomList", "list");
getCommands().registerMethod(new WarCommands(), List.of("war", "room"), "deletePlanningChannel", "delete_planning");
getCommands().registerMethod(new UtilityCommands(), List.of("land"), "landROI", "roi");
getCommands().registerMethod(new UtilityCommands(), List.of("infra"), "infraROI", "roi");
getCommands().registerMethod(new ConflictCommands(), List.of("conflict"), "syncConflictData", "sync");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4286,6 +4286,21 @@ public String sortWarRooms(@Me WarCategory warCat) {
return "Done! Moved " + moved + " channels";
}

@RolePermission(value = Roles.MILCOM)
@Command(desc = "Delete planning war rooms with no participants")
public String deletePlanningChannel(@Me WarCategory warCat) {
for (Map.Entry<Integer, WarCategory.WarRoom> entry : new HashMap<>(warCat.getWarRoomMap()).entrySet()) {
WarCategory.WarRoom room = entry.getValue();
if (room.channel == null) continue;
if (!room.getParticipants().isEmpty()) continue;
if (!room.isPlanning()) continue;
room.addInitialParticipants(false);
if (!room.getParticipants().isEmpty()) continue;
room.delete("Manually deleted");
}
return "Done. Please wait for rooms to finish deleting";
}

@RolePermission(value = Roles.MILCOM)
@Command(desc = "Create a war room\n" +
"Add `-p` to ping users that are added\n" +
Expand Down

0 comments on commit 6dd2944

Please sign in to comment.