1
votes

Sending this to the server will join a channel:

JOIN #channel-name

This will send a message:

PRIVMSG #channel-name :YOUR MESSAGE HERE

How can I send a command?

In my IRC client, if I type /list, it will list all the channels. I try to send /list programmatically using PRIVMSG, but it literally sends /list and doesn't return channel names.

1
/list is not sent as a PRIVMSG to the server. Use the LIST command. - Greg Hewgill
ircsock.send('LIST'):verne.freenode.net 421 Mybot LISTPRIVMSG :Unknown command - user3893623
It sounds like you aren't sending \r\n after your LIST command. - Greg Hewgill

1 Answers

1
votes

You send the string "LIST\r\n" to the socket using

socketname.send("LIST\r\n")

And then you wait for numeric 321, 322 and 323. IRC/2 Numeric List lists the numerics you need to listen to and their format:

321 RPL_LISTSTART RFC1459 Channels :Users Name Channel list - Header
322 RPL_LIST RFC1459 <#_visible> : Channel list - A channel
323 RPL_LISTEND RFC1459 : Channel list - End of list