Last active
December 28, 2015 04:08
-
-
Save rafaelgaspar/7439674 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on getiTunesCurrentSong() | |
tell application "iTunes" | |
try | |
if not (exists current track) then return "" | |
return (get name of current track) & " - " & (get artist of current track) | |
end try | |
end tell | |
end getiTunesCurrentSong | |
using terms from application "Messages" | |
on message sent theMessage for theChat | |
if theMessage begins with "/itunes" then | |
set iTunesCurrentSong to getiTunesCurrentSong() | |
if iTunesCurrentSong is not equal "" then | |
return "/me listening to " & iTunesCurrentSong & "." | |
else | |
return "/me is not listening to anything right now." | |
end if | |
end if | |
end message sent | |
# The following are unused but need to be defined to avoid an error | |
on message received theMessage from theBuddy for theChat | |
end message received | |
on chat room message received theMessage from theBuddy for theChat | |
end chat room message received | |
on active chat message received theMessage | |
end active chat message received | |
on addressed chat room message received theMessage from theBuddy for theChat | |
end addressed chat room message received | |
on addressed message received theMessage from theBuddy for theChat | |
end addressed message received | |
on received text invitation theText from theBuddy for theChat | |
end received text invitation | |
on received audio invitation theText from theBuddy for theChat | |
end received audio invitation | |
on received video invitation theText from theBuddy for theChat | |
end received video invitation | |
on received remote screen sharing invitation from theBuddy for theChat | |
end received remote screen sharing invitation | |
on received local screen sharing invitation from theBuddy for theChat | |
end received local screen sharing invitation | |
on received file transfer invitation theFileTransfer | |
end received file transfer invitation | |
on buddy authorization requested theRequest | |
end buddy authorization requested | |
on av chat started | |
end av chat started | |
on av chat ended | |
end av chat ended | |
on login finished for theService | |
end login finished | |
on logout finished for theService | |
end logout finished | |
on buddy became available theBuddy | |
end buddy became available | |
on buddy became unavailable theBuddy | |
end buddy became unavailable | |
on completed file transfer | |
end completed file transfer | |
end using terms from |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment