use of com.mcmoddev.mmdbot.modules.commands.community.server.CmdToggleEventPings in project MMDBot by MinecraftModDevelopment.
the class CommandModule method setupCommandModule.
/**
* Setup and load the bots command module.
*/
public static void setupCommandModule() {
commandClient = new CommandClientBuilder().setOwnerId(MMDBot.getConfig().getOwnerID()).setPrefix(MMDBot.getConfig().getMainPrefix()).setAlternativePrefix(MMDBot.getConfig().getAlternativePrefix()).useHelpBuilder(false).setManualUpsert(true).build();
addSlashCommand(new CmdHelp(), new CmdGuild(), new CmdAbout(), new CmdUser(), new CmdRoles(), new CmdCatFacts(), new CmdSearch("google", "https://www.google.com/search?q=", "goog"), new CmdSearch("bing", "https://www.bing.com/search?q="), new CmdSearch("duckduckgo", "https://duckduckgo.com/?q=", "ddg"), new CmdSearch("lmgtfy", "https://lmgtfy.com/?q=", "let-me-google-that-for-you"), new CmdToggleMcServerPings(), new CmdToggleEventPings(), new CmdForgeVersion(), new CmdMinecraftVersion(), new CmdFabricVersion(), new CmdMute(), new CmdUnmute(), new CmdCommunityChannel(), new CmdOldChannels(), new CmdAvatar(), new CmdRename(), // TODO Setup DB storage for tricks and polish them off/add permission restrictions for when needed.
new CmdShutdown(), new CmdRestart(), new CmdQuote(), new CmdRolePanel(), new CmdWarning(), new CmdTrick(), new CmdInvite(), new CmdDictionary(), new CmdEvaluate(), new CmdRawTrick());
// addSlashCommand(Tricks.getTricks().stream().map(CmdRunTrickSeparated::new).toArray(SlashCommand[]::new));
commandClient.addCommand(new CmdRefreshScamLinks());
commandClient.addCommand(new CmdReact());
commandClient.addCommand(new CmdGist());
commandClient.addCommand(new CmdEvaluate());
commandClient.addCommand(new CmdAddTrick.Prefix());
commandClient.addCommand(new CmdEditTrick.Prefix());
addContextMenu(new ContextMenuGist());
addContextMenu(new ContextMenuAddQuote());
addContextMenu(new ContextMenuUserInfo());
if (MMDBot.getConfig().prefixTricksEnabled()) {
Tricks.getTricks().stream().map(CmdRunTrick.Prefix::new).forEach(commandClient::addCommand);
}
if (MMDBot.getConfig().isCommandModuleEnabled()) {
// Wrap the command and button listener in another thread, so that if a runtime exception
// occurs while executing a command, the event thread will not be stopped
// Commands and buttons are separated so that they do not interfere with each other
MMDBot.getJDA().addEventListener(new ThreadedEventListener((EventListener) commandClient, COMMAND_LISTENER_THREAD_POOL));
MMDBot.getJDA().addEventListener(buttonListener(CmdRoles.getListener()));
MMDBot.getJDA().addEventListener(buttonListener(CmdHelp.getListener()));
MMDBot.getJDA().addEventListener(buttonListener(CmdListTricks.getListListener()));
MMDBot.getJDA().addEventListener(buttonListener(CmdQuote.ListQuotes.getQuoteListener()));
MMDBot.getJDA().addEventListener(buttonListener(CmdInvite.ListCmd.getButtonListener()));
MMDBot.getJDA().addEventListener(buttonListener(CmdDictionary.listener));
MMDBot.getJDA().addEventListener(buttonListener(new DismissListener()));
MMDBot.LOGGER.warn("Command module enabled and loaded.");
} else {
MMDBot.LOGGER.warn("Command module disabled via config, commands will not work at this time!");
}
}
Aggregations