Skip to content

Commit 42de7cf

Browse files
Remove orga role and permission deployment
1 parent 04c68d6 commit 42de7cf

File tree

7 files changed

+3
-61
lines changed

7 files changed

+3
-61
lines changed

bot/src/main/java/de/chojo/gamejam/Bot.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import javax.sql.DataSource;
4343
import java.io.IOException;
4444
import java.sql.SQLException;
45-
import java.util.Collections;
4645
import java.util.Optional;
4746
import java.util.concurrent.ExecutorService;
4847
import java.util.concurrent.Executors;
@@ -122,21 +121,19 @@ private void buildLocale() {
122121
}
123122

124123
private void buildCommands() {
125-
var settings = new Settings(jamData, guildData);
126124
commandHub = CommandHub.builder(shardManager)
127-
.withManagerRole(guild -> Collections.singletonList(guildData.getSettings(guild).join().orgaRole()))
128125
.withLocalizer(localizer)
129126
.useGuildCommands()
130127
.withCommands(new JamAdmin(jamData),
131128
new Register(jamData),
132-
settings,
129+
new Settings(jamData, guildData),
133130
new Team(teamData, jamData),
134131
new Unregister(jamData, teamData),
135132
new Votes(jamData, teamData))
133+
.withPermissionCheck((event, meta) -> true)
136134
.withPagination(builder -> builder.withLocalizer(localizer).withCache(cache -> cache.expireAfterAccess(30, TimeUnit.MINUTES)))
137135
.withButtonService(builder -> builder.withLocalizer(localizer).withCache(cache -> cache.expireAfterAccess(30, TimeUnit.MINUTES)))
138136
.build();
139-
settings.init(commandHub);
140137
}
141138

142139
private void initBot() throws LoginException {

bot/src/main/java/de/chojo/gamejam/commands/Settings.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import de.chojo.gamejam.commands.settings.Info;
1010
import de.chojo.gamejam.commands.settings.JamRole;
1111
import de.chojo.gamejam.commands.settings.Locale;
12-
import de.chojo.gamejam.commands.settings.OrgaRole;
1312
import de.chojo.gamejam.commands.settings.TeamSize;
1413
import de.chojo.gamejam.data.GuildData;
1514
import de.chojo.gamejam.data.JamData;
@@ -27,7 +26,6 @@
2726

2827
public class Settings extends SimpleCommand {
2928
private final JamData jamData;
30-
private final OrgaRole orgaRole;
3129
private final Locale locale;
3230

3331
private final Map<String, SubCommand<JamSettings>> subCommandMap;
@@ -46,12 +44,10 @@ public Settings(JamData jamData, GuildData guildData) {
4644
.addSubCommand("info", "command.settings.info.description")
4745
.build());
4846
this.jamData = jamData;
49-
orgaRole = new OrgaRole(guildData);
5047
locale = new Locale(guildData);
5148
subCommandMap = new MapBuilder<String, SubCommand<JamSettings>>()
5249
.add("jam_role", new JamRole(jamData))
5350
.add("team_size", new TeamSize(jamData))
54-
.add("orga_role", orgaRole)
5551
.add("locale", locale)
5652
.add("info", new Info(guildData))
5753
.build();
@@ -67,9 +63,4 @@ public void onSlashCommand(SlashCommandInteractionEvent event, SlashCommandConte
6763
}
6864
}).whenComplete(Future.handleComplete());
6965
}
70-
71-
public void init(CommandHub<?> commandHub) {
72-
orgaRole.setCommandHub(commandHub);
73-
locale.setCommandHub(commandHub);
74-
}
7566
}

bot/src/main/java/de/chojo/gamejam/commands/settings/Locale.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
public final class Locale implements SubCommand<JamSettings> {
1717
private final GuildData guildData;
18-
private CommandHub<?> commandHub;
1918

2019
public Locale(GuildData guildData) {
2120
this.guildData = guildData;
@@ -31,12 +30,8 @@ public void execute(SlashCommandInteractionEvent event, SlashCommandContext cont
3130
guildData.updateSettings(guildSettings)
3231
.thenRun(() -> {
3332
event.reply(context.localize("command.settings.locale.updated")).setEphemeral(true).queue();
34-
commandHub.refreshGuildCommands(event.getGuild());
33+
context.commandHub().refreshGuildCommands(event.getGuild());
3534
});
3635
}, () -> event.reply(context.localize("command.settings.locale.invalid")).setEphemeral(true).queue());
3736
}
38-
39-
public void setCommandHub(CommandHub<?> commandHub) {
40-
this.commandHub = commandHub;
41-
}
4237
}

bot/src/main/java/de/chojo/gamejam/commands/settings/OrgaRole.java

Lines changed: 0 additions & 38 deletions
This file was deleted.

bot/src/main/resources/locale.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ command.settings.locale.invalid=
3636
command.settings.locale.updated=
3737
command.settings.orgaRole.arg.role=
3838
command.settings.orgaRole.description=
39-
command.settings.orgaRole.updated=
4039
command.settings.teamSize.arg.size=
4140
command.settings.teamSize.description=
4241
command.settings.teamSize.updated=

bot/src/main/resources/locale_de_DE.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ command.settings.locale.invalid=Ungültiges Gebietsschema
3636
command.settings.locale.updated=Lokale aktualisiert
3737
command.settings.orgaRole.arg.role=Die Rolle, die den Bot verwalten kann
3838
command.settings.orgaRole.description=Definiere die Rolle des Organisationsteams
39-
command.settings.orgaRole.updated=Die Organisationsrolle wird aktualisiert.
4039
command.settings.teamSize.arg.size=Die maximale Teamgröße.
4140
command.settings.teamSize.description=Definiere die maximale Teamgröße.
4241
command.settings.teamSize.updated=Aktualisierte maximale Teamgröße.

bot/src/main/resources/locale_en_US.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ command.settings.locale.invalid=Invalid locale
3636
command.settings.locale.updated=Locale updated
3737
command.settings.orgaRole.arg.role=The role which can manage the bot
3838
command.settings.orgaRole.description=Define the organisation team role
39-
command.settings.orgaRole.updated=Updated the organization role.
4039
command.settings.teamSize.arg.size=The max team size.
4140
command.settings.teamSize.description=Define the max team size.
4241
command.settings.teamSize.updated=Updated max team size.

0 commit comments

Comments
 (0)