Skip to content

Commit

Permalink
Add support for target-text-channels for Slash Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Doc94 committed Jan 20, 2022
1 parent 1e04108 commit 7bd2eff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/uk/co/angrybee/joe/DiscordClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,13 @@ public void onSlashCommand(SlashCommandEvent event) {
return;
}

if (!Arrays.asList(targetTextChannels).contains(event.getTextChannel().getId())) {
MessageEmbed messageEmbed = CreateEmbeddedMessage("Sorry!",
("This bot can only used in the specified chcannel."), EmbedMessageType.FAILURE).build();
ReplyAndRemoveAfterSeconds(event, messageEmbed);
return;
}

String subcommand = event.getSubcommandName();
OptionMapping mc_name_op = event.getOption("minecraft_username");
String mc_name = null;
Expand Down

0 comments on commit 7bd2eff

Please sign in to comment.