Ah… Turns out it only works if you send the CAP REQ commands after the USER/NICK. Maybe I read it wrong, but the IRCv3 specification seemed to specifically say that you must send the CAP REQ before that, which is why I did it yesterday when it wouldn’t work. It works now.
This is the page I read: Redirecting… The part that confused me, and still confuses me, is this:
Upon connecting to the IRC server, clients SHOULD send one of the following messages:
CAP LS [version]to discover the available capabilities on the server.CAP REQto blindly request a particular set of capabilities.Following this, the client MUST send the standard
NICKandUSERIRC commands.