Receive Adium Messages in Applescript

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

I covered the lol part with a few simple send and delay retry commands, but I also need to do some interaction.
Answer yes to something with a question mark, for example ...

Believe me or not, such a simple bot will pass the Turing test for these conversations.

Opening the Adium dictionary does not show the obvious way to receive messages, nor does the Growl dictionary.

I found out that I can run the script every time I receive a message. Is there any way to access the sent message?

Adium pref http://media.ruk.ca/images/adiumpreferences.png

My code is:

tell application "Adium" activate set theChat to the active chat send theChat message "Hi" delay 5 send theChat message "How 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 
+7
applescript adium
source share
2 answers

Now you can connect to the script using the Pipe Event .

+3
source share

Based on a review of the current Adium source code and a search for current and past elements in Adium trackers and wikis that contain both โ€œapplescriptโ€ and โ€œmessageโ€ as substrings, this is not possible when using only AppleScript in Adium 1.0 to 1.3 .10 (last at the time of writing). This seems to have been possible with the simple AppleScript in Adium 0.89.1, but volunteer developers are not yet convinced that adding this feature back is worth the effort.

To access the contents of a message in AppleScript right now, you may need to write Adium Xtra to forward the information. Examples of Xtra plugins that access the text of the last post include Challenge / Response or SpamFilter . The source code for SpamFilter is available on BitBucket, so you can modify it to send the contents of the message to AppleScript.

EDIT: Since I posted my answer, zostay user noticed a new Adium Xtra called " Event for Trumpets ". It allows you to send the text of the event to the script exactly as I imagined when I wrote my second paragraph, so I am responsible for the post. Source code is also available.

+1
source share

All Articles