use of com.freya02.bot.Config in project BotCommands by freya022.
the class FieldInjMain method main.
public static void main(String[] args) {
try {
final Config config = Config.readConfig();
final JDA jda = JDABuilder.createLight(config.getToken()).build().awaitReady();
// Just a test value
Connection connection = null;
CommandsBuilder.newBuilder().extensionsBuilder(extensionsBuilder -> extensionsBuilder.registerCommandDependency(Connection.class, () -> connection)).build(jda, "com.freya02.bot.wiki.fieldinj.commands");
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
use of com.freya02.bot.Config in project BotCommands by freya022.
the class InstanceSupplierMain method main.
public static void main(String[] args) {
try {
final Config config = Config.readConfig();
final JDA jda = JDABuilder.createLight(config.getToken()).build().awaitReady();
CommandsBuilder.newBuilder().extensionsBuilder(extensionsBuilder -> extensionsBuilder.registerInstanceSupplier(SlashInstanceSupplierTest.class, ignored -> new SlashInstanceSupplierTest(new SlashInstanceSupplierTest.Dummy()))).build(jda, "com.freya02.bot.wiki.instancesupplier.commands");
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
use of com.freya02.bot.Config in project BotCommands by freya022.
the class CondInstMain method main.
public static void main(String[] args) {
try {
final Config config = Config.readConfig();
final JDA jda = JDABuilder.createLight(config.getToken()).build().awaitReady();
CommandsBuilder.newBuilder().build(jda, "com.freya02.bot.wiki.condinst.commands");
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
use of com.freya02.bot.Config in project BotCommands by freya022.
the class Main method main.
public static void main(String[] args) {
try {
// Make sure that the file Config.json exists under src/main/java/resources/com/freya02/bot/Config.json and has a valid token inside
final Config config = Config.readConfig();
// Set up JDA
final JDA jda = JDABuilder.createLight(config.getToken()).setActivity(Activity.playing("Prefix is " + config.getPrefix())).build().awaitReady();
// Print some information about the bot
LOGGER.info("Bot connected as {}", jda.getSelfUser().getAsTag());
LOGGER.info("The bot is present on these guilds :");
for (Guild guild : jda.getGuildCache()) {
LOGGER.info("\t- {} ({})", guild.getName(), guild.getId());
}
// Instantiate the database needed for components
final ComponentsDB componentsDB = new ComponentsDB(config);
// Build the command framework:
// Prefix: configured in Config.json
// Owner: configured in Config.json
// Commands package: com.freya02.bot.commands
CommandsBuilder.newBuilder(config.getOwnerId()).textCommandBuilder(textCommandsBuilder -> textCommandsBuilder.addPrefix(config.getPrefix())).setComponentManager(new DefaultComponentManager(componentsDB::getConnection)).build(jda, // Registering listeners is taken care of by the lib
"com.freya02.bot.commands");
} catch (IOException | InterruptedException | LoginException | SQLException e) {
LOGGER.error("Unable to start the bot", e);
System.exit(-1);
}
}
use of com.freya02.bot.Config in project BotCommands by freya022.
the class CtorInjMain method main.
public static void main(String[] args) {
try {
final Config config = Config.readConfig();
final JDA jda = JDABuilder.createLight(config.getToken()).build().awaitReady();
// alt1(jda);
alt2(jda);
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
Aggregations