Just write an applescript that does what it is supposed to do. Read the applescript documentation for iChat.
After that is done. Use the script toghether with the CLI tools osacompile and osascript to make a CLI app that does what you want it to.
Simple enough? I am not in here that often so...