Skip to content

Commit

Permalink
feat: yeah yeah yeah
Browse files Browse the repository at this point in the history
  • Loading branch information
yaansz committed Aug 28, 2024
1 parent d2cfbe7 commit 92fa842
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;

@DiscordController(value = "basic",description = "Basic Controller")
@DiscordController(value = "basic", description = "Basic Controller")
public class BasicController {

@DiscordCommand(name = "hello", description = "Hello World", ephemeral = true)
Expand All @@ -35,7 +36,8 @@ public void response(SlashCommandInteractionEvent event) {
@DiscordCommand(name = "embed", description = "Embed")
public String greetings(@RequestInfo Member member,
@DiscordParameter(name = "name", description = "Your name") String name,
@DiscordParameter(name = "occupation", description = "Your occupation") String occupation) {
@DiscordParameter(name = "occupation", description = "Your occupation") String occupation,
@DiscordParameter(name = "channel", description = "Channel", required = false) GuildChannelUnion channel) {
return "Hello, " + name + "! You are a " + occupation + "!";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public void reportForm(@RequestInfo Member member, Guild guild, JDA jda,

if(reported == null) {
event.reply("User not found").setEphemeral(true).queue();
return;
}

MessageEmbed embed = new EmbedBuilder().setTitle("Report").setColor(Color.RED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public String getLocalizedString(String key, DiscordLocale userLocale, Object ..
mask = locales.get(defaultLocale);
}

String result = MessageFormatter.arrayFormat(mask, args).getMessage();
return result;
return MessageFormat.format(mask, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
Expand Down Expand Up @@ -108,6 +109,15 @@ else if(parameter.getType().equals(Guild.class)) {
else if(MessageChannelUnion.class.isAssignableFrom(parameter.getType()) && event instanceof CommandInteractionPayload payload) {
return getChannel(payload, parameter);
}
else if(GuildChannelUnion.class.isAssignableFrom(parameter.getType()) && event instanceof CommandInteractionPayload payload) {
return getChannel(payload, parameter);
}
else if(parameter.getType().equals(GuildChannelUnion.class)) {
return event.getChannel();
}
else if(parameter.getType().equals(MessageChannelUnion.class)) {
return event.getChannel();
}
else {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/translated_en_US.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
translated.hello.response = Hello, {}!
translated.bye.response = Bye, {}!
translated.hello.response = Hello, {0}!
translated.bye.response = Bye, {0}!
4 changes: 2 additions & 2 deletions src/main/resources/translated_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ translated.hello.description = Exemplo de descri
translated.hello.name.name = nome
translated.hello.name.description = Digite seu nome

translated.hello.response = Olá, {}!
translated.hello.response = Olá, {0}!

translated.bye.name = tchau
translated.bye.description = Exemplo de descrição de tchau

translated.bye.name.name = nome
translated.bye.name.description = Digite seu nome

translated.bye.response = Tchau, {}!
translated.bye.response = Tchau, {0}!

0 comments on commit 92fa842

Please sign in to comment.