Skip to content

Commit

Permalink
Account for text-based channels other than text channels when handlin…
Browse files Browse the repository at this point in the history
…g commands
  • Loading branch information
CominAtYou committed Jun 5, 2024
1 parent 1b6c651 commit f5b9447
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.cominatyou</groupId>
<artifactId>hildabot</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>

<name>hildabot</name>
<url>https://github.com/CominAtYou/Hildabot</url>
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/cominatyou/TextCommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.cominatyou.commands.*;
Expand All @@ -14,6 +15,8 @@
import org.javacord.api.event.message.MessageCreateEvent;

public class TextCommandHandler {
private static final List<ChannelType> textChannelTypes = Arrays.asList(ChannelType.getTextChannelTypes());

// Commands that can be run in both private channels and guild text channels
private static final Map<String, TextCommand> sharedCommands = Map.ofEntries(
entry("levelalert", new LevelAlert()),
Expand Down Expand Up @@ -51,7 +54,7 @@ public static void getCommand(MessageCreateEvent event) {
if (sharedCommands.containsKey(command)) {
sharedCommands.get(command).execute(event, messageArgs);
}
else if (event.getChannel().getType() == ChannelType.SERVER_TEXT_CHANNEL && guildCommands.containsKey(command)) {
else if (textChannelTypes.contains(event.getChannel().getType()) && guildCommands.containsKey(command)) {
guildCommands.get(command).execute(event, messageArgs);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/cominatyou/util/versioning/Version.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.cominatyou.util.versioning;

public class Version {
public static final String VERSION = "2.6.1";
public static final String BUILD_NUMBER = "11G047";
public static final String VERSION = "2.6.2";
public static final String BUILD_NUMBER = "11G048";
public static final String VERSION_STRING = String.format("%s (%s)", VERSION, BUILD_NUMBER);
}

0 comments on commit f5b9447

Please sign in to comment.