KittehOrg / KittehIRCClientLib

An IRC client library in Java
https://kitteh.dev/kicl/
MIT License
146 stars 35 forks source link

My bot does not connect on my channel #296

Closed CoreException closed 3 years ago

CoreException commented 3 years ago

Hello, I have already created a UnrealIRCd Sever on my root and actually have the bot ready so it should connect on my channel. But unfortunately it does not. In the console comes no exception or anything else. By the way, when I ask if the ChannelList is empty, the console displays true. I am just new in this area, so it is possible that it is a totally dumb error. Thanks in advance

Here is my Main class:

`

public static class Listener {
    @Handler
    public void meow(ChannelJoinEvent event) {
        System.out.println("I am connected!");
    }

    @CommandFilter("PRIVMSG")
    @Handler
    public void privmsg(ClientReceiveCommandEvent event) {
        System.out.println("We get signal!");
    }

}

public static void main(String[] args) {
    Client client = Client.builder()
            .server().host("MY_SERVER").port(443)
            .password("oauth:MY_OAUTH_TOKEN").then()
            .nick("corebot")
            .build();
    TwitchSupport.addSupport(client);
    client.getEventManager().registerEventListener(new Listener());
    client.addChannel("#coreexception");
    client.connect();
    client.sendMessage("#coreexception", "I'm here! :)");
    System.out.println("Bot started!");
    //client.getChannels().forEach(channel -> System.out.println(channel.getName()));
    if (client.getChannels().isEmpty()) System.out.println(true);

}

`

mbax commented 3 years ago

Howdy! I think it's worth doing some basic debugging on what the server is sending back. Check out the debugging section here and set it up like what's given as example: https://kitteh-irc-client-library.readthedocs.io/en/latest/#getting-started

A couple things to keep in mind as well:

These probably won't be the cause of the overall not-actually-joining issue, though, so I'll be interested to see the debugging output.

CoreException commented 3 years ago

Hey thanks for your help! I did the debugging and got the following result:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Bot started! 33:38 [O] CAP LS 302 33:38 [O] PASS oauth:MY_OAUTH_TOKEN 33:38 [O] USER Kitteh 8 * :KICL 7.4.0 - kitteh.org 33:38 [O] NICK corebot 33:38 [I] HTTP/1.1 400 Bad Request 33:38 [I] Date: Sun, 21 Feb 2021 10:33:38 GMT 33:38 [I] Server: Apache/2.4.38 (Debian) 33:38 [I] Content-Length: 308 33:38 [I] Connection: close 33:38 [I] Content-Type: text/html; charset=iso-8859-1 33:38 [I] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

I guess I made a mistake while setting up the UnrealIRCd server. What I can say in any case is that I made the host to my website which has a valid HTTPS certificate. And I connect through a domain. Or the website may not be HTTPS at all?

With best regards CoreException

mbax commented 3 years ago

Probably want to give it the port unreal is using rather than the httpd port 😁

Have a great day!