use of com.freya02.botcommands.api.application.annotations.Test 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.botcommands.api.application.annotations.Test in project BotCommands by freya022.
the class CtorInjMain method alt2.
private static void alt2(JDA jda) throws IOException {
// Just a test value
Connection connection = null;
CommandsBuilder.newBuilder().extensionsBuilder(extensionsBuilder -> extensionsBuilder.registerInstanceSupplier(SlashCtorInjectionTest.class, context -> new SlashCtorInjectionTest(context, connection))).build(jda, "com.freya02.bot.wiki.ctorinj.commands");
}
use of com.freya02.botcommands.api.application.annotations.Test in project BotCommands by freya022.
the class CtorInjMain method alt1.
private static void alt1(JDA jda) throws IOException {
// Just a test value
Connection connection = null;
CommandsBuilder.newBuilder().extensionsBuilder(extensionsBuilder -> extensionsBuilder.registerConstructorParameter(Connection.class, ignored -> connection)).build(jda, "com.freya02.bot.wiki.ctorinj.commands");
}
use of com.freya02.botcommands.api.application.annotations.Test in project BotCommands by freya022.
the class AnnotationUtils method getEffectiveTestGuildIds.
public static TLongSet getEffectiveTestGuildIds(BContext context, Method method) {
TLongSet testIds = new TLongHashSet(context.getTestGuildIds());
final List<Test> effectiveAnnotations = getEffectiveAnnotations(method, Test.class);
for (Test test : effectiveAnnotations) {
final long[] ids = test.guildIds();
final AppendMode mode = test.mode();
if (mode == AppendMode.SET) {
testIds.clear();
testIds.addAll(ids);
return testIds;
} else if (mode == AppendMode.ADD) {
testIds.addAll(ids);
}
}
return testIds;
}
Aggregations