Skip to content

Commit

Permalink
Tweak twitter template
Browse files Browse the repository at this point in the history
  • Loading branch information
chromakode authored Jun 26, 2022
1 parent 75b2478 commit 45d5484
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions link-publisher.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ async function tweet(row) {
const tag = str => `#${str.toLowerCase().replace(' ', '')}`

const client = new Twitter(TWITTER_CREDS)
const statusStart = `${row.Source} ${tag(row.City)} ${tag(row.State)} #live ${tag(row.Type)} ${tag(row.View)} `
const statusStart = `${row.Source} ${tag(row.City)} ${tag(row.State)} #live`
const statusEnd = `\n${row.Link}`
const maxLen = 280
const notesLength = maxLen - statusStart.length - statusEnd.length - 1
const status = `${statusStart}${row.Notes ? ' ' + truncate(row.Notes, {length: notesLength}) : ''}${statusEnd}`
const status = `${statusStart}${row.Notes ? '(' + truncate(row.Notes, {length: notesLength}) + ')' : ''}${statusEnd}`
try {
await client.post('statuses/update', {status})
} catch (err) {
Expand Down

0 comments on commit 45d5484

Please sign in to comment.