views:

317

answers:

1

I'm trying to write a simple chat bot for Adium, that will post "lol" and "haha" and answer basic questions in annoying group chats that some people keep adding me to.

I've covered the "lol" part with a few simple send and delay commands in a repeat, but I need to do some interaction as well.
Answer "yes" to anything with a question mark for example...

Believe me or not, such a simple bot would pass a Turing Test for those conversations.

Opening the Adium dictionary does not reveal any obvious way of getting messages, nor does the Growl dictionary.

I did found out that I can run a script every time a message is received, Is there a way to get access to the sent message?

Adium pref

My code:

tell application "Adium"
    activate
    set theChat to the active chat
    send theChat message "Hi"
    delay 5
    send theChat message "How's life?"
    delay 10
    repeat 10 times
        send theChat message "Realy?"
        delay 5
        send theChat message "Lol :P"
        delay 15
        send theChat message "Haha XD"
        delay 15
        send theChat message "Yes1!!1"
        delay 20
        send theChat message "I like it! :D"
        delay 10
    end repeat
    send theChat message "Bye!"
    tell theChat to close
end tell
A: 

Based on review of the current Adium sourcecode and a search for current and past items in the Adium bug tracker and wiki which contain both "applescript" and "message" as substrings, this does not appear to be possible when using only AppleScript in Adium 1.0 through 1.3.10 (latest at time of writing). It seems to have been possible with plain AppleScript in Adium 0.89.1, but the volunteer developers are not yet convinced that adding this feature back is worth the effort.

To access the message content in AppleScript right now probably requires writing an Adium Xtra to forward the information. Examples of Xtra plugins that access the text of last message include Challenge/Response or SpamFilter. The sourcecode for SpamFilter is available on BitBucket, so you could conceivably modify it to send message contents to an AppleScript.

IIsi 50MHz