Hammster / php-irc-bot

A minimal IRC Bot written in PHP following a subset of RFC1459
MIT License
5 stars 6 forks source link

How login to user account #1

Open MSIKT4AV opened 4 years ago

MSIKT4AV commented 4 years ago

How add code to login as user by name and password?

Hammster commented 4 years ago

I have not done this in years but according to RFC1459 you simply need to send a PASS with your password before logging in.

I updated the code to include a example usage

https://github.com/Hammster/php-irc-bot/blob/1d4508bf58b6e736160e6c9150a1103135c8abce/bot.php#L6-L18

MSIKT4AV commented 4 years ago

Still i cant login. Look:

Guest PASS :Unknown command Guest JOIN :You have not registered

Hammster commented 4 years ago

What network are you trying to join, some require you to do something like

Please look up the according docs or the IRC you're connecting to. My code is the one according to RFC1459, but it's up to the IRC server to decide how the login system works

MSIKT4AV commented 4 years ago

I try connect to: https://poorchat.net/channels/api https://prnt.sc/qv42k1

By HexChat is working, but not by php code. I dont know how to write this

Hammster commented 4 years ago

From https://old.poorchat.net/faq you can see

/msg Poorchat LOGIN [nazwa_uzytkownika] [haslo]

so this means you need to send a message after setting your user

 fputs($socket, "USER " . $nickname . " 0 * :" . $master . "'s Bot\n"); 
 fputs($socket, "NICK " . $nickname . "\n");
 fputs($socket, "PRIVMSG Poorchat LOGIN " . $nickname . " " . $password . "\n"); 
MSIKT4AV commented 4 years ago

:irc.poorchat.net 451 Guest JOIN :You have not registered :irc.poorchat.net 451 Guest PRIVMSG :You have not registered

;/ can you try connect to this chat? i can give you password/login