Skip to content

Commit

Permalink
Merge pull request #592 from beanbeanjuice/562-json-menu-items
Browse files Browse the repository at this point in the history
Moved Menu Items to JSON File
  • Loading branch information
beanbeanjuice committed Sep 19, 2023
2 parents 6db11ba + e7640a0 commit 4bc431b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.beanbeanjuice.utility.helper.Helper;
import com.beanbeanjuice.utility.command.CommandCategory;
import com.beanbeanjuice.utility.command.ICommand;
import com.beanbeanjuice.utility.section.cafe.MenuHandler;
import com.sun.management.OperatingSystemMXBean;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.MessageEmbed;
Expand Down Expand Up @@ -43,6 +44,14 @@ public void handle(@NotNull SlashCommandInteractionEvent event) {
"The AI responses have been successfully refreshed!"
)).queue();
}

case "menu" -> {
MenuHandler.refreshMenu();
event.getHook().sendMessageEmbeds(Helper.successEmbed(
"Menu Refreshed",
"The menu has been successfully updated!"
)).queue();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ public class AIResponseListener extends ListenerAdapter {
*/
public AIResponseListener() {
messageMap = new HashMap<>();

try {
createMaps();
} catch (IOException e) {
Bot.getLogger().log(AIResponseListener.class, LogLevel.ERROR, "There was an error establishing AI responses.", false, true, e);
}
refreshMaps();
}

/**
* Refreshes the AI maps if the file has changed.
*/
public void refreshMaps() {
messageMap.clear();

Expand Down

0 comments on commit 4bc431b

Please sign in to comment.