Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Prettier format
Browse files Browse the repository at this point in the history
  • Loading branch information
spences10 committed Jul 25, 2017
1 parent 48b9a8e commit 80d9082
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/api/reply.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const reply = (event) => {
// get user's twitter handler/screen name
let screenName = event.source.screen_name

if (screenName===config.twitterConfig.username) {
if (screenName === config.twitterConfig.username) {
return
}
const response = randomReply()

const res = response.replace('${screenName}', screenName);
const res = response.replace('${screenName}', screenName)

tweetNow(res)
}
Expand Down
67 changes: 37 additions & 30 deletions src/api/retweet.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,47 @@ const queryString = unique(param.queryString.split(','))
const bot = new Twit(config.twitterKeys)

const retweet = () => {

const query = queryString()

bot.get('search/tweets', {
q: query,
result_type: param.resultType,
lang: param.language,
filter: 'safe',
count: param.searchCount
}, (err, data, response) => {
if (err) {
console.log('ERRORDERP: Cannot Search Tweet!, Description here: ', err)
} else {
// grab tweet ID to retweet
const rando = Math.floor(Math.random() * param.searchCount) + 1
let retweetId
bot.get(
'search/tweets',
{
q: query,
result_type: param.resultType,
lang: param.language,
filter: 'safe',
count: param.searchCount
},
(err, data, response) => {
if (err) {
console.log('ERRORDERP: Cannot Search Tweet!, Description here: ', err)
} else {
// grab tweet ID to retweet
const rando = Math.floor(Math.random() * param.searchCount) + 1
let retweetId

try {
retweetId = data.statuses[rando].id_str
} catch (e) {
console.log('ERRORDERP: Cannot assign retweeID')
return
}

try {
retweetId = data.statuses[rando].id_str
} catch (e) {
console.log('ERRORDERP: Cannot assign retweeID')
return
bot.post(
'statuses/retweet/:id',
{
id: retweetId
},
(err, response) => {
if (err) {
console.log('ERRORDERP: Retweet!')
}
console.log('SUCCESS: RT: ', data.statuses[rando].text, 'RANDO ID: ', rando)
}
)
}

bot.post('statuses/retweet/:id', {
id: retweetId
}, (err, response) => {
if (err) {
console.log('ERRORDERP: Retweet!')
}
console.log('SUCCESS: RT: ', data.statuses[rando].text, 'RANDO ID: ', rando)
})
}
})
)
}

module.exports = retweet
module.exports = retweet

0 comments on commit 80d9082

Please sign in to comment.