Skip to content

Instantly share code, notes, and snippets.

@pgdaniel
Created December 6, 2014 01:25
Show Gist options
  • Save pgdaniel/a11260b0450b99bbbb3a to your computer and use it in GitHub Desktop.
Save pgdaniel/a11260b0450b99bbbb3a to your computer and use it in GitHub Desktop.
Auto Reply
using terms from application "Messages"
# The following are unused but need to be defined to avoid an error
on message sent theMessage with eventDescription
end message sent
on message received theMessage with eventDescription
end message received
on chat room message received with eventDescription
end chat room message received
#on active chat message received with eventDescription
#end active chat message received
on active chat message received theMessage from theBuddy for theChat with eventDescription
set myFile to (POSIX path of (path to desktop)) & ".temp-pug.jpg"
do shell script "curl -L " & getPug() & " -o " & myFile
set pugAttachment to POSIX file myFile
send "???" to theBuddy
#send pugAttachment to theBuddy
end active chat message received
on received text invitation with eventDescription
end received text invitation
on received audio invitation theText from theBuddy for theChat with eventDescription
end received audio invitation
on received video invitation theText from theBuddy for theChat with eventDescription
end received video invitation
on received local screen sharing invitation from theBuddy for theChat with eventDescription
end received local screen sharing invitation
on buddy authorization requested with eventDescription
end buddy authorization requested
on addressed chat room message received with eventDescription
end addressed chat room message received
on received remote screen sharing invitation with eventDescription
end received remote screen sharing invitation
on login finished with eventDescription
end login finished
on logout finished with eventDescription
end logout finished
on buddy became available with eventDescription
end buddy became available
on buddy became unavailable with eventDescription
end buddy became unavailable
on received file transfer invitation theFileTransfer with eventDescription
end received file transfer invitation
on av chat started with eventDescription
end av chat started
on av chat ended with eventDescription
end av chat ended
on completed file transfer with eventDescription
end completed file transfer
end using terms from
to getPug()
tell application "JSON Helper"
set pugAPI to fetch JSON from ("http://pugme.herokuapp.com/random")
set pugURL to pug of pugAPI
return (pugURL)
end tell
end getPug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment