lmariscal / twitchirc

Twitch Bot Development made Easier | DEPRECATED
Other
40 stars 15 forks source link

sendRawMessage Returns NullPointerExeception #21

Closed Squidkingdom closed 7 years ago

Squidkingdom commented 7 years ago

Hello, I attempted to use a scanner to take input from a console and send it as a message using the sendMessage() function. How ever when i run the bot. I get a NullPointer from the flush of the sendRaw message . I don't know what I did wrong. The people on this form are so nice and I hope someone can help me or point me to where I can get help. Thank you so much and below is a pastebin with my seperate class's code and one line of code i added to my Main Method (new Thread(new input())).start(); https://pastebin.com/Dpr7fqtf

Squidkingdom commented 7 years ago

Edit: For some reason in this._something_ the this is "input" instead of "Botty"

mvarendorff commented 7 years ago

I can neither see a this in your code nor a sendMessage(). That this is input makes sense if you use it in your input class... Have you tried creating a constructor for input and for Botty with the line super(), in it. This will execute the constructor of the super class as well. So Botty() will be executed by input() and the constructor of the TwitchBot library by Botty(). This should make sure that the Stream that is used to write to the chat is initialized. I think that that might cause the problem.

Squidkingdom commented 7 years ago

The this is in the sendRawMessage() (this.writer.write()) function. And Its giving me errors when I implement super() I eventually just "Threw shit at a wall and saw what stuck" I ended up having method after method retriving method after method and manipulated witch writer i got and it worked!