Trouble trying to receive messages at a IRC twitch bot

I’m trying to make a chat bot for a twitch channel, but when I use the method onMessage, from the PircBot framework, it doesn’t do anything.

I’ve logged at the chat correctly but I don’t know why this doesn’t work; here’s the code:

Bot.Java:

public String Channel = ""; //Here goes the channel name

public MisterDiosBot(String name) {
    setName(name);
    setLogin(name);
}


@Override
public void onConnect() {
    sendMessage(Channel, "Bot connected");
}

@Override
public void onMessage(String channel, String sender, String login, String hostname, String message) {
    sendMessage("LEÑERASFJAOLFJAOLKSFHJLASJDLASJFDLASJSLDJASLDJALSDJALSKJD");
}
@Override
public void onJoin(String Channel, String sender, String login, String hostname) {
    sendMessage(Canal, login+ " has joined the channel!");
}

Main.java:

public static Bot bot = new Bot("ElDiosDeLosBOTS");

public static void main(String[] args) {
    bot.setVerbose(true);
    try {
        bot.connect("irc.twitch.tv", 6667, "oauth");
    } catch (IOException e) {
        e.printStackTrace();
    } catch (IrcException e) {
        e.printStackTrace();
        System.out.println("Error connecting");
    }

}

I don’t see any error. The IDE doesn’t show me any errors either, so I don’t know what it could be.

Is the channel name all in lowercase? It needs to be.

Yes, it’s in lowercase, the bot connects to the chat and i can send messages with the bot, but it doesn’t receive any message and it doesn’t call these methods :S

I don’t see the bot joining a channel anywhere in that code.

1 Like

Yes, at the Main class

The code you provided only connects to the server but doesn’t join any channel as 3ventic mentioned.
You have to do something like this after connecting (idk the exact call)

bot.join(channel);

If you do this already then you should provide this code as well.

2 Likes

Omg thank both of you, i feel so stupid right now xD

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.