Irssi is a modular chat client with IRC built-in. It's multi-protocol friendly for module authors, and includes Perl scripting with a wide range of available extensions.