Here is what I use:
(defun my-erc-join-libre-chat ()
"Connect to Libera Chat IRC server."
;; This gets my password, I'm using a .authinfo.gpg file, but a similar approach for GNU Pass should work.
(let ((credential (auth-source-pick-first-password :host "irc.libre.chat")))
(erc :server "irc.libera.chat"
:port 6667
:password credential
:nick "my-nick" ; replace with your nick as appropriate
:id "Libera.Chat")))
;; here is how I use the above:
(defun my-erc-join-libre-systemcrafters-live ()
"Connect to libera chat IRC channel for SystemCrafters-Live."
(interactive)
(my-erc-join-libre-chat)
(sleep-for 3) ; wait a bit before sending the following commands
(erc-cmd-JOIN "#systemcrafters-live")
;; wait until the systemcrafters-live channel buffer has been
;; created.
(while (= 0 (length (match-buffers "^#systemcrafters-live")))
(sleep-for 1))
(switch-to-buffer-other-window "#systemcrafters-live"))
Does this help?