Getting Started...

226 views
Skip to first unread message

Matheus Henrique da Silva

unread,
Feb 4, 2014, 1:02:07 PM2/4/14
to pirc...@googlegroups.com
I noticed that there is a difference between some implementations on PircBotx and it have confused me so much.

On this page the example shows the code:
 public static void main(String[] args) throws Exception {
               
PircBotX bot = new PircBotX();
                bot
.setName("PircBotXUser");
                bot
.connect("irc.freenode.net");
                bot
.joinChannel("#pircbotx");
       
}

But when i've tried to do the same, the only constructor receives a Configuration parameter

When i've tried to do a configuration set, like in this page:

//Setup this bot
                Configuration configuration = new Configuration.Builder()
                                .setName("PircBotX") //Set the nick of the bot. CHANGE IN YOUR CODE
                                .setLogin("LQ") //login part of hostmask, eg name:login@host
                                .setAutoNickChange(true) //Automatically change nick when the current one is in use
                                .setCapEnabled(true) //Enable CAP features
                                .addCapHandler(new TLSCapHandler(new UtilSSLSocketFactory().trustAllCertificates(), true))
                                .addListener(new PircBotXExample()) //This class is a listener, so add it to the bots known listeners
                                .setServerHostname("irc.freenode.net")
                                .addAutoJoinChannel("#pircbotx") //Join the official #pircbotx channel
                                .buildConfiguration();

                //bot.connect throws various exceptions for failures
                try {
                        PircBotX bot = new PircBotX(configuration);
                        //Connect to the freenode IRC network
                        bot.startBot();
                } //In your code you should catch and handle each exception seperately,
                //but here we just lump them all togeather for simpliciy
                catch (Exception ex) {
                        ex.printStackTrace();
                }


I get some errors like these:

02-04 17:50:54.377: E/Trace(1085): error opening trace file: No such file or directory (2)
02-04 17:50:55.047: I/dalvikvm(1085): Could not find method com.google.common.collect.Maps.newHashMap, referenced from method org.pircbotx.Configuration$Builder.<init>
02-04 17:50:55.067: W/dalvikvm(1085): VFY: unable to resolve static method 5166: Lcom/google/common/collect/Maps;.newHashMap ()Ljava/util/HashMap;
02-04 17:50:55.067: D/dalvikvm(1085): VFY: replacing opcode 0x71 at 0x006d
02-04 17:50:55.087: I/dalvikvm(1085): Could not find method com.google.common.collect.Maps.newHashMap, referenced from method org.pircbotx.Configuration$Builder.<init>
02-04 17:50:55.097: W/dalvikvm(1085): VFY: unable to resolve static method 5166: Lcom/google/common/collect/Maps;.newHashMap ()Ljava/util/HashMap;
02-04 17:50:55.097: D/dalvikvm(1085): VFY: replacing opcode 0x71 at 0x006d
02-04 17:50:55.137: I/dalvikvm(1085): Could not find method com.google.common.collect.Maps.newHashMap, referenced from method org.pircbotx.Configuration$Builder.<init>
02-04 17:50:55.137: W/dalvikvm(1085): VFY: unable to resolve static method 5166: Lcom/google/common/collect/Maps;.newHashMap ()Ljava/util/HashMap;
02-04 17:50:55.137: D/dalvikvm(1085): VFY: replacing opcode 0x71 at 0x006d
02-04 17:50:55.177: W/dalvikvm(1085): VFY: unable to find class referenced in signature (Lcom/google/common/collect/ImmutableSet;)
02-04 17:50:55.177: I/dalvikvm(1085): Could not find method com.google.common.collect.ImmutableSet.iterator, referenced from method org.pircbotx.Configuration$Builder.setListenerManager
02-04 17:50:55.177: W/dalvikvm(1085): VFY: unable to resolve virtual method 5151: Lcom/google/common/collect/ImmutableSet;.iterator ()Ljava/util/Iterator;
02-04 17:50:55.187: D/dalvikvm(1085): VFY: replacing opcode 0x6e at 0x0008
02-04 17:50:55.197: D/AndroidRuntime(1085): Shutting down VM
02-04 17:50:55.197: W/dalvikvm(1085): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
02-04 17:50:55.207: E/AndroidRuntime(1085): FATAL EXCEPTION: main
02-04 17:50:55.207: E/AndroidRuntime(1085): java.lang.NoClassDefFoundError: com.google.common.collect.Maps
02-04 17:50:55.207: E/AndroidRuntime(1085): at org.pircbotx.Configuration$Builder.<init>(Configuration.java:334)
02-04 17:50:55.207: E/AndroidRuntime(1085): at com.example.irclient.MainActivity.onCreate(MainActivity.java:28)
02-04 17:50:55.207: E/AndroidRuntime(1085): at android.app.Activity.performCreate(Activity.java:5104)
02-04 17:50:55.207: E/AndroidRuntime(1085): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-04 17:50:55.207: E/AndroidRuntime(1085): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
02-04 17:50:55.207: E/AndroidRuntime(1085): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-04 17:50:55.207: E/AndroidRuntime(1085): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-04 17:50:55.207: E/AndroidRuntime(1085): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-04 17:50:55.207: E/AndroidRuntime(1085): at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 17:50:55.207: E/AndroidRuntime(1085): at android.os.Looper.loop(Looper.java:137)
02-04 17:50:55.207: E/AndroidRuntime(1085): at android.app.ActivityThread.main(ActivityThread.java:5041)
02-04 17:50:55.207: E/AndroidRuntime(1085): at java.lang.reflect.Method.invokeNative(Native Method)
02-04 17:50:55.207: E/AndroidRuntime(1085): at java.lang.reflect.Method.invoke(Method.java:511)
02-04 17:50:55.207: E/AndroidRuntime(1085): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-04 17:50:55.207: E/AndroidRuntime(1085): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-04 17:50:55.207: E/AndroidRuntime(1085): at dalvik.system.NativeStart.main(Native Method)
02-04 17:55:55.467: I/Process(1085): Sending signal. PID: 1085 SIG: 9

I have no ideia what to do. Can someone help me?

Matheus Henrique da Silva

unread,
Feb 4, 2014, 1:25:56 PM2/4/14
to pirc...@googlegroups.com
I forgot to say I'm developing an Android application. I dont found anything implementing PircBotX on Android. Sorry.

Leon Blakey

unread,
Feb 4, 2014, 2:40:57 PM2/4/14
to pirc...@googlegroups.com
First, some of the tutorials are out of date and rewriting them for 2.0 is a work in progress: https://code.google.com/p/pircbotx/issues/detail?id=164


With your android app logs, it looks like guava isn't added as a dependency (java.lang.NoClassDefFoundError: com.google.common.collect.Maps). Make sure its uploaded along with the rest of the libraries. My android knowledge is extremely limited so I can't help you much with that, sorry.


--
You received this message because you are subscribed to the Google Groups "pircbotx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pircbotx+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Matheus Henrique da Silva

unread,
Feb 4, 2014, 4:37:33 PM2/4/14
to pirc...@googlegroups.com
Thank you very much. I already installed the components and finally my bot conects. But i donk know how to disconect it (lol).

Leon Blakey

unread,
Feb 4, 2014, 4:51:19 PM2/4/14
to pirc...@googlegroups.com
bot.sendIRC().quitServer() is the easiest way to disconnect

Matheus Henrique da Silva

unread,
Feb 5, 2014, 5:31:39 AM2/5/14
to pirc...@googlegroups.com
Thank you.
Reply all
Reply to author
Forward
0 new messages