Skip to content

Commit

Permalink
Making requested by text language independent.
Browse files Browse the repository at this point in the history
  • Loading branch information
DxsSucuk committed Jan 4, 2024
1 parent 0f2cfa3 commit 3447f3f
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions languages/en-GB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ label:
rewards: "Rewards"
sendToChat: "Send in Chat"
avatar: "Avatar"
footerMessage: "Requested by %s - %s"
message:
default:
usage: "Usage {guild_prefix}%s."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public AudioPlayerReceiveHandler(Member member, AudioChannelUnion audioChannelUn
message = audioChannelUnion.asGuildMessageChannel().sendMessageEmbeds(new EmbedBuilder()
.setDescription(LanguageService.getByGuild(member.getGuild(), "message.recording.started"))
.setColor(Color.YELLOW)
.setFooter("Requested by " + member.getEffectiveName() + " - " + BotConfig.getAdvertisement(), member.getEffectiveAvatarUrl())
.setFooter(LanguageService.getByGuild(member.getGuild(),"label.footerMessage", member.getEffectiveAvatarUrl(), BotConfig.getAdvertisement()), member.getEffectiveAvatarUrl())
.setTitle(LanguageService.getByGuild(member.getGuild(), "label.recording.start"))
.build()).complete();

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/de/presti/ree6/commands/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,11 @@ public void sendMessage(EmbedBuilder embedBuilder, int deleteSecond, MessageChan
* @param interactionHook the Interaction-hook, if it is a slash event.
*/
public void deleteMessage(Message message, InteractionHook interactionHook) {
if (message != null && message.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE) && message.getChannel().retrieveMessageById(message.getIdLong()).complete() != null && message.getType().canDelete() && !message.isEphemeral() && interactionHook == null) {
if (message != null && message.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE) &&
message.getChannel().retrieveMessageById(message.getIdLong()).complete() != null &&
message.getType().canDelete() &&
!message.isEphemeral() &&
interactionHook == null) {
message.delete().onErrorMap(throwable -> {
log.error("[CommandManager] Couldn't delete a Message!", throwable);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setTitle(commandEvent.getResource("label.randomCatImage"));
em.setColor(BotWorker.randomEmbedColor());
em.setImage(js.get(0).getAsJsonObject().get("url").getAsString());
em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl());
em.setFooter(commandEvent.getResource("label.footerMessage", commandEvent.getMember().getEffectiveAvatarUrl(), BotConfig.getAdvertisement()), commandEvent.getMember().getEffectiveAvatarUrl());

commandEvent.reply(em.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setTitle(commandEvent.getResource("label.randomDogImage"));
em.setColor(BotWorker.randomEmbedColor());
em.setImage(js.get("message").getAsString());
em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl());
em.setFooter(commandEvent.getResource("label.footerMessage", commandEvent.getMember().getEffectiveAvatarUrl(), BotConfig.getAdvertisement()), commandEvent.getMember().getEffectiveAvatarUrl());

commandEvent.reply(em.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setDescription(commandEvent.getResource("message.default.retrievalError"));
}

em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl());
em.setFooter(commandEvent.getResource("label.footerMessage", commandEvent.getMember().getEffectiveAvatarUrl(), BotConfig.getAdvertisement()), commandEvent.getMember().getEffectiveAvatarUrl());
commandEvent.reply(em.build());

}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/presti/ree6/commands/impl/fun/Monkey.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setTitle(commandEvent.getResource("label.monkey"));
em.setColor(BotWorker.randomEmbedColor());
em.setImage("https://c.tenor.com/Y89PE1f7exQAAAAd/reject-modernity-return-to-monke.gif");
em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl());
em.setFooter(commandEvent.getResource("label.footerMessage", commandEvent.getMember().getEffectiveAvatarUrl(), BotConfig.getAdvertisement()), commandEvent.getMember().getEffectiveAvatarUrl());

commandEvent.reply(em.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setTitle(commandEvent.getResource("label.randomShibaImage"));
em.setColor(BotWorker.randomEmbedColor());
em.setImage(js.get(0).getAsString());
em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl());
em.setFooter(commandEvent.getResource("label.footerMessage", commandEvent.getMember().getEffectiveAvatarUrl(), BotConfig.getAdvertisement()), commandEvent.getMember().getEffectiveAvatarUrl());

Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void sendAvatar(User member, CommandEvent commandEvent) {
em.setTitle(commandEvent.getResource("label.avatar"));
em.setAuthor(member.getEffectiveName() + (UserUtil.isSupporter(member) ? " <a:duckswing:1070690323459735682>" : ""), member.getEffectiveAvatarUrl(), member.getEffectiveAvatarUrl());
em.setImage(member.getEffectiveAvatar().getUrl(1024));
em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl());
em.setFooter(commandEvent.getResource("label.footerMessage", commandEvent.getMember().getEffectiveAvatarUrl(), BotConfig.getAdvertisement()), commandEvent.getMember().getEffectiveAvatarUrl());

commandEvent.reply(em.build());
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/presti/ree6/commands/impl/info/Info.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void sendInfo(Member member, CommandEvent commandEvent) {
em.addField("**Created Date**", member.getTimeCreated().toLocalDate().format(DateTimeFormatter.ofPattern("dd.MM.yyyy")), true);
em.addField("**Joined Date**", member.getTimeJoined().toLocalDate().format(DateTimeFormatter.ofPattern("dd.MM.yyyy")), true);

em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl());
em.setFooter(commandEvent.getResource("label.footerMessage", commandEvent.getMember().getEffectiveAvatarUrl(), BotConfig.getAdvertisement()), commandEvent.getMember().getEffectiveAvatarUrl());

commandEvent.reply(em.build());
}
Expand Down

0 comments on commit 3447f3f

Please sign in to comment.