Unable to register for IRC capabilities

I’ve started making a chat bot in python.
It works for everything PRIVMSG related, that is, until I add code to request capabilities.

s = socket.socket()
s.connect((HOST, PORT))
s.send("PASS " + AUTH + "\r\n")
s.send("NICK " + ID + "\r\n")
s.send("CAP REQ :twitch.tv/membership")
s.send("CAP REQ :twitch.tv/commands")
s.send("CAP REQ :twitch.tv/tags")
s.send("JOIN #" + ROOM + "\r\n")

This is the code I’m using to do so and it results in

:tmi.twitch.tv 001 leviporton :Welcome, GLHF!
:tmi.twitch.tv 002 leviporton :Your host is tmi.twitch.tv
:tmi.twitch.tv 003 leviporton :This server is rather new
:tmi.twitch.tv 004 leviporton :-
:tmi.twitch.tv 375 leviporton :-
:tmi.twitch.tv 372 leviporton :You are in a maze of twisty passages, all alike.
:tmi.twitch.tv 376 leviporton :>
:tmi.twitch.tv CAP * NAK :twitch.tv/membershipCAP REQ :twitch.tv/commandsCAP REQ :twitch.tv/tagsJOIN #leviporton

It does not connect to the channel, where did I go wrong?

s.send("CAP REQ :twitch.tv/membership")
s.send("CAP REQ :twitch.tv/commands")
s.send("CAP REQ :twitch.tv/tags")

should be

s.send("CAP REQ :twitch.tv/membership\r\n")
s.send("CAP REQ :twitch.tv/commands\r\n")
s.send("CAP REQ :twitch.tv/tags\r\n")

or

s.send("CAP REQ :twitch.tv/membership twitch.tv/commands twitch.tv/tags\r\n")

You were not terminating your lines with a carriage return

1 Like

I’ve been pulling my hair out over this for a few hours now, that fixed it.

Thank you so much.

Welcome, glad to have been of help!

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