Closed BlackRose01 closed 6 years ago
How exactly are you building your dependencies? Are you using jar files or compiling via Maven/Gradle?
I compile via Maven. I also used the jar files but i get the same the error.
Can you supply me the full source code of your sample project so that I can reproduce the issue?
I think you don't have the AbilityBot dependancy. Do you have the following code in your pom.xml?
`
<artifactId>telegrambots-abilities</artifactId>
<version>3.5</version>
`
I haven't checked if this would work but it could help you.
Edit: If you didn't include the AbilityBot in Maven (look the code on top) then it should work. I have tested it now and It's working.
@Fricofresh This is the package I use from Maven. I also tried the compiled jar with all dependencies.
The code is attached. ExampleBot.txt
I also tested from add37 the examplebots but I get the same error.
https://github.com/addo37/ExampleBots/tree/master/src/main/java/org/telegram/examplebots
Any updates for this issue @BlackRose01? Otherwise, I'll work on exploring the issue. It still believe it's a packaging/DM issue.
Hello @addo37, I tried some code snippets and I figured out that the ApiContextInitializer also have to initialize. I thought that it must not be implement. So I think the problem is solved but I forgot to close this topic. Thank you for the reply.
Hello there,
I've got a problem with starting my AbilityBot. When I try to start the code below I get the following error. Even the ExampleBot doesn't work. The TelegramBot-Package is from Maven in Version 3.5.
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/collections/impl/list/mutable/primitive/LongArrayList at org.mapdb.StoreDirectAbstract.<init>(StoreDirectAbstract.kt:41) at org.mapdb.StoreWAL.<init>(StoreWAL.kt:31) at org.mapdb.StoreWAL$Companion.make(StoreWAL.kt:56) at org.mapdb.StoreWAL$Companion.make$default(StoreWAL.kt:55) at org.mapdb.DBMaker$Maker.make(DBMaker.kt:464) at org.telegram.abilitybots.api.db.MapDBContext.onlineInstance(MapDBContext.java:57) at org.telegram.abilitybots.api.bot.AbilityBot.<init>(AbilityBot.java:149) at Gaia.Nereide.Telegram.<init>(Telegram.java:41) at Gaia.Nereide.Telegram.<init>(Telegram.java:51) at Gaia.Nereide.Start.main(Start.java:13)
Here is my code:
`import org.telegram.abilitybots.api.bot.AbilityBot; import org.telegram.abilitybots.api.objects.Ability;
import static org.telegram.abilitybots.api.objects.Locality.ALL; import static org.telegram.abilitybots.api.objects.Privacy.PUBLIC;
public class ExampleBot extends AbilityBot { public static final String BOT_TOKEN = "BOT_TOKEN"; public static final String BOT_USERNAME = "BOT_USERNAME";
public ExampleBot() { super(BOT_TOKEN, BOT_USERNAME); }
@Override public int creatorId() { return 123456789; }
public Ability sayHelloWorld() { return Ability .builder() .name("hello") .info("says hello world!") .locality(ALL) .privacy(PUBLIC) .action(ctx -> silent.send("Hello world!", ctx.chatId())) .build(); } }`
I can't find any solution for this problem. Where is the problem?
Thank you.