Created
April 22, 2012 18:43
-
-
Save shstkvch/2466121 to your computer and use it in GitHub Desktop.
Facebook Scripting Concept
This file contains 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
// Facebook User Scripting | |
// A (conceptual) scripting interface for Facebook (by David Hewitson, if it matters.) | |
var people_who_think_i_rock = 0; | |
me.onWallPost(function(post) { | |
// someone's posted on my wall! | |
if(post.message == 'You rock!') { | |
// someone thinks I rock! | |
post.like(); // like the post | |
people_who_think_i_rock++; // increment the rockometer | |
// send them a nice reply on their own wall | |
post.sender.wall.post('You rock too! (: <3 xoxoxo'); | |
} else { | |
// do nothing | |
} | |
}); | |
me.onChatMessage(function(message, chat) { | |
// someone's sent me a chat message! | |
if(message.text.toLowerCase() == 'hello') { | |
// someone said hello! say hello back... | |
chat.send_message('yo! did you know ' + people_who_think_i_rock + ' people think I rock?'); | |
} | |
}); | |
me.onFriendRequest(function(request) { | |
// zomfg new friend! | |
var new_friend = request.sender; | |
if(new_friend.sex == 'female' && new_friend.age >= 18) { | |
if(new_friend.can_message === true) { // can we send her a message? | |
new_friend.send_message('Hey there, ' + new_friend.name + | |
'! I\'m accepting your friend request because I like the ladieees!'); | |
request.accept() // accept the request! | |
people_who_think_i_rock++; // I must seriously rock today | |
var ross = me.friends.get('36103013900913'); | |
ross.send_message('DUDE! this girl added me: ' + new_friend.profile_url + '!'); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment