Browse Source

Skip tweeting pages with "HTMLhouse" title

Plus add #web hashtag
tags/v1.0
Matt Baer 8 years ago
parent
commit
ded8e33677
2 changed files with 9 additions and 2 deletions
  1. +1
    -1
      construction.go
  2. +8
    -1
      twitter.go

+ 1
- 1
construction.go View File

@@ -126,7 +126,7 @@ func addPublicAccess(app *app, houseID, html string) error {
}

// Tweet about it
tweet(app, houseID, fmt.Sprintf("\"%s\" on #HTMLhouse - %s/%s.html #html #website", title, app.cfg.HostName, houseID))
tweet(app, houseID, title)

return nil
}


+ 8
- 1
twitter.go View File

@@ -6,7 +6,12 @@ import (
"github.com/ChimeraCoder/anaconda"
)

func tweet(app *app, houseID, text string) {
func tweet(app *app, houseID, title string) {
// Check for blacklisted titles
if title == "HTMLhouse" {
return
}

// Check if this has already been tweeted
var tweetID int64
err := app.db.QueryRow("SELECT tweet_id FROM tweetedhouses WHERE house_id = ?", houseID).Scan(&tweetID)
@@ -20,6 +25,8 @@ func tweet(app *app, houseID, text string) {
}

// Post to Twitter
text := fmt.Sprintf("\"%s\" on #HTMLhouse - %s/%s.html #html #web #website", title, app.cfg.HostName, houseID)

anaconda.SetConsumerKey(app.cfg.TwitterConsumerKey)
anaconda.SetConsumerSecret(app.cfg.TwitterConsumerSecret)
api := anaconda.NewTwitterApi(app.cfg.TwitterToken, app.cfg.TwitterTokenSecret)


Loading…
Cancel
Save