Advertisement
giancarlofleuri

TINDER INSTRUÇÕES

Nov 24th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. Installation
  2.  
  3. $ npm install tinderbot
  4. Setup
  5.  
  6. Create a Facebook application
  7.  
  8. This won't need to be approved, nor publicly available. Visit the Facebook developer center and select "Apps > Create a New App". Give it a name (I named mine "TinderBot") and a category (e.g "Communication").
  9.  
  10. Authorize localhost as a Valid OAuth redirect URI
  11.  
  12. Once your app has been created, follow the Settings link in the app's dashboard, and go over to the Advanced tab. Look for "Valid OAuth redirect URI's" and add http://localhost:8080/fbtoken (or whatever you decide to use for your listen port). Also ensure the "Client OAuth Login" setting is enabled.
  13.  
  14. Setting up your tinder bot
  15.  
  16. Copy your app's App Id from the main dashboard for your app. Then, create a new .js (e.g bot.js) file with the following contents:
  17.  
  18. var tinderbot = require('tinderbot');
  19. var bot = new tinderbot();
  20.  
  21. bot.FBClientId = <app id>
  22. bot.FBClientSecret = <app secret>
  23.  
  24. bot.mainLoop = function() {
  25. console.log("Hello world!");
  26. };
  27.  
  28. bot.live();
  29. Running the bot
  30.  
  31. In a console, execute
  32.  
  33. $ node bot.js
  34. To authorize your bot to act on behalf of your Facebook profile, open up a browser and visit http://localhost:8080/login. You should be prompted for your Facebook credentials. Once logged in, look back at the console and notice the periodic "Hello world" logs. Congratulations, you've just created your first Tinder bot! Make sure you keep this window open if you're planning on running your bot for a long time (ie more than an hour or so), as it will automatically refresh when your Facebook tokens have expired.
  35.  
  36. Configuration
  37.  
  38. .mainLoop
  39.  
  40. This should be set to a function that will be executed periodically. Whenever this is executed, you can assume that your bot is authorized to interact with the Tinder API on behalf of your Facebook profile. Typically you would call methods from the tinderjs module to interact with the API.
  41.  
  42. .mainLoopInterval
  43.  
  44. The interval in milliseconds at which the mainLoop is executed.
  45.  
  46. .port
  47.  
  48. Your bot wraps a simple express server. This will be the port the server listens on.
  49.  
  50. .client
  51.  
  52. This is the authorized tinder client you can use to interact with the tinder API
  53.  
  54. .live()
  55.  
  56. This starts the express server.
  57.  
  58. .die()
  59.  
  60. This kills the express server.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement