 app.configure 'production', ->
   app.use express.errorHandler()
 
-
-
 Twitter = new twit {
   consumer_key: process.env.consumer_key,
   consumer_secret: process.env.consumer_secret,

stream = Twitter.stream 'statuses/filter', {track:'fuck'}

id = 0
stream.on 'tweet', (tweet) ->
  if tweet.coordinates
    tweets.push {text: "@" + tweet.user.screen_name + " : " + tweet.text, coordinates: tweet.coordinates.coordinates, id:id++}




# Array of re-tweeted screen_names to avoid spam
twitterUsernameArray = []

limit = 1

# Reset the limit of retweets every 20 seconds
resetLimit = -> limit = 1
setInterval resetLimit, 20000

# Retweet logic
retweet = (screen_name, tweetID) ->
  if limit is 0
    return
  else limit--
  if twitterUsernameArray[screen_name]
    console.log screen_name + " already retweeted!"
  else
    Twitter.post 'statuses/retweet/:id', { id: tweetID }, (err) ->
      if err
       console.log err
