Skip to content

Commit

Permalink
Implemented a fix for #217
Browse files Browse the repository at this point in the history
Fixed missing Language resource.
  • Loading branch information
DxsSucuk committed Dec 20, 2022
1 parent fb3e189 commit 063d285
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 10 deletions.
3 changes: 2 additions & 1 deletion languages/en-GB.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language:
name: "English (UK)"
locale: "en-GB"
version: "2.1.8"
version: "2.1.9"
author: "Presti"
logging:
banned: ":airplane_departure: %s **banned.**"
Expand Down Expand Up @@ -175,6 +175,7 @@ label:
error: "Error"
game: "Game"
viewer: "Viewer"
more: "More"
message:
default:
usage: "Usage {guild_prefix}%s."
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/presti/ree6/commands/impl/mod/Blacklist.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ public void onPerform(CommandEvent commandEvent) {
commandEvent.reply(commandEvent.getResource("message.blacklist.addedList","```" + end + "```"), 5);
} else {
ModerationUtil.blacklist(commandEvent.getGuild().getId(), commandEvent.getArguments()[1]);
commandEvent.reply(commandEvent.getResource("message.blacklist.list.added", commandEvent.getArguments()[1]), 5);
commandEvent.reply(commandEvent.getResource("message.blacklist.added", commandEvent.getArguments()[1]), 5);
}
} else if(commandEvent.getArguments()[0].equalsIgnoreCase("remove")) {
ModerationUtil.removeBlacklist(commandEvent.getGuild().getId(), commandEvent.getArguments()[1]);
commandEvent.reply(commandEvent.getResource("message.blacklist.list.removed", commandEvent.getArguments()[1]), 5);
commandEvent.reply(commandEvent.getResource("message.blacklist.removed", commandEvent.getArguments()[1]), 5);
} else {
commandEvent.reply(commandEvent.getResource("message.default.invalidQuery"), 5);
commandEvent.reply(commandEvent.getResource("message.default.usage","blacklist add/remove/list"),5);
Expand Down
82 changes: 75 additions & 7 deletions src/main/java/de/presti/ree6/events/MenuEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.List;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;

/**
* EventHandler for Menu Events.
Expand Down Expand Up @@ -831,8 +832,23 @@ public void onStringSelectInteraction(@NotNull StringSelectInteractionEvent even
return;
}

String value = event.getInteraction().getValues().get(0);

EmbedBuilder embedBuilder = new EmbedBuilder(event.getMessage().getEmbeds().get(0));

if (value.equalsIgnoreCase("more")) {
java.util.List<SelectOption> optionList = new ArrayList<>();

for (TextChannel channel : event.getGuild().getTextChannels().stream().skip(24).toList()) {
optionList.add(SelectOption.of(channel.getName(), channel.getId()));
}

embedBuilder.setDescription(LanguageService.getByGuild(event.getGuild(), "message.ticket.setupDescription"));

event.editMessageEmbeds(embedBuilder.build()).setActionRow(new StringSelectMenuImpl("setupTickets", LanguageService.getByGuild(event.getGuild(), "label.selectChannel"), 1, 1, false, optionList)).queue();
return;
}

MessageChannel messageChannel = event.getGuild().getTextChannelById(event.getInteraction().getValues().get(0));

if (messageChannel != null) {
Expand Down Expand Up @@ -882,7 +898,12 @@ public void onStringSelectInteraction(@NotNull StringSelectInteractionEvent even

case "ticketsSetup" -> {
for (TextChannel channel : event.getGuild().getTextChannels()) {
optionList.add(SelectOption.of("%1.25s".formatted(channel.getName()), channel.getId()));
if (optionList.size() == 24) {
optionList.add(SelectOption.of(LanguageService.getByGuild(event.getGuild(), "label.more"), "more"));
break;
}

optionList.add(SelectOption.of(channel.getName(), channel.getId()));
}

embedBuilder.setDescription(LanguageService.getByGuild(event.getGuild(), "message.ticket.setupDescription"));
Expand Down Expand Up @@ -916,9 +937,24 @@ public void onStringSelectInteraction(@NotNull StringSelectInteractionEvent even
return;
}

String value = event.getInteraction().getValues().get(0);

EmbedBuilder embedBuilder = new EmbedBuilder(event.getMessage().getEmbeds().get(0));

VoiceChannel voiceChannel = event.getGuild().getVoiceChannelById(event.getInteraction().getValues().get(0));
if (value.equalsIgnoreCase("more")) {
java.util.List<SelectOption> optionList = new ArrayList<>();

for (VoiceChannel channel : event.getGuild().getVoiceChannels().stream().skip(24).toList()) {
optionList.add(SelectOption.of(channel.getName(), channel.getId()));
}

embedBuilder.setDescription(LanguageService.getByGuild(event.getGuild(), "message.temporalVoice.setupDescription"));

event.editMessageEmbeds(embedBuilder.build()).setActionRow(new StringSelectMenuImpl("setupTempVoicechannel", LanguageService.getByGuild(event.getGuild(), "label.selectChannel"), 1, 1, false, optionList)).queue();
return;
}

VoiceChannel voiceChannel = event.getGuild().getVoiceChannelById(value);

if (voiceChannel != null) {
SQLSession.getSqlConnector().getSqlWorker().updateEntity(new TemporalVoicechannel(event.getGuild().getId(), voiceChannel.getId()));
Expand Down Expand Up @@ -947,7 +983,12 @@ public void onStringSelectInteraction(@NotNull StringSelectInteractionEvent even

case "tempVoiceSetup" -> {
for (VoiceChannel channel : event.getGuild().getVoiceChannels()) {
optionList.add(SelectOption.of("%1.25s".formatted(channel.getName()), channel.getId()));
if (optionList.size() == 24) {
optionList.add(SelectOption.of(LanguageService.getByGuild(event.getGuild(), "label.more"), "more"));
break;
}

optionList.add(SelectOption.of(channel.getName(), channel.getId()));
}

embedBuilder.setDescription(LanguageService.getByGuild(event.getGuild(), "message.temporalVoice.setupDescription"));
Expand Down Expand Up @@ -1012,7 +1053,12 @@ public void onStringSelectInteraction(@NotNull StringSelectInteractionEvent even

case "logSetup" -> {
for (TextChannel channel : event.getGuild().getTextChannels()) {
optionList.add(SelectOption.of("%1.25s".formatted(channel.getName()), channel.getId()));
if (optionList.size() == 24) {
optionList.add(SelectOption.of(LanguageService.getByGuild(event.getGuild(), "label.more"), "more"));
break;
}

optionList.add(SelectOption.of(channel.getName(), channel.getId()));
}

embedBuilder.setDescription(LanguageService.getByGuild(event.getGuild(), "message.auditLog.setupDescription"));
Expand Down Expand Up @@ -1050,9 +1096,30 @@ public void onStringSelectInteraction(@NotNull StringSelectInteractionEvent even
return;
}

String value = event.getInteraction().getValues().get(0);

EmbedBuilder embedBuilder = new EmbedBuilder(event.getMessage().getEmbeds().get(0));

TextChannel textChannel = event.getGuild().getTextChannelById(event.getInteraction().getValues().get(0));
if (value.equals("more")) {
java.util.List<SelectOption> optionList = new ArrayList<>();

for (TextChannel channel : event.getGuild().getTextChannels().stream().skip(24).toList()) {
if (optionList.size() == 24) {
optionList.add(SelectOption.of(LanguageService.getByGuild(event.getGuild(), "label.more"), "more"));
break;
}

optionList.add(SelectOption.of(channel.getName(), channel.getId()));
}

embedBuilder.setDescription(LanguageService.getByGuild(event.getGuild(), "message.auditLog.setupDescription"));

event.editMessageEmbeds(embedBuilder.build()).setActionRow(new StringSelectMenuImpl("setupLogChannel", LanguageService.getByGuild(event.getGuild(), "label.selectChannel"), 1, 1, false, optionList)).queue();
return;
}


TextChannel textChannel = event.getGuild().getTextChannelById(value);

if (textChannel != null) {
textChannel.createWebhook("Ree6-Logs").queue(webhook -> {
Expand Down Expand Up @@ -1087,8 +1154,9 @@ public void onStringSelectInteraction(@NotNull StringSelectInteractionEvent even
case "backToSetupMenu" -> sendDefaultChoice(event);

case "welcomeSetup" -> {
for (TextChannel channel : event.getGuild().getTextChannels()) {
optionList.add(SelectOption.of("%1.25s".formatted(channel.getName()), channel.getId()));
if (optionList.size() == 24) {
optionList.add(SelectOption.of(LanguageService.getByGuild(event.getGuild(), "label.more"), "more"));
break;
}

embedBuilder.setDescription(LanguageService.getByGuild(event.getGuild(), "message.welcome.setupDescription"));
Expand Down

0 comments on commit 063d285

Please sign in to comment.