Last active
February 2, 2021 23:00
-
-
Save KieronQuinn/f62396a965648459273f58ff04b31553 to your computer and use it in GitHub Desktop.
@jschwatt_owo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Twit = require('twit') | |
const owo = require('@zuzak/owo') | |
var T = new Twit({ | |
consumer_key: '', | |
consumer_secret: '', | |
access_token: '', | |
access_token_secret: '', | |
timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests. | |
strictSSL: false, // optional - requires SSL certificates to be valid. | |
}) | |
let userId = "4694011844" | |
let userId2 = "1237157616951758848" | |
let isUsingQuotes = false | |
const stream = T.stream('statuses/filter', { | |
follow: [userId, userId2] | |
}); | |
function parseTweet(tweet){ | |
if(tweet.user.id_str != userId && tweet.user.id_str != userId2) return | |
if(tweet.retweeted_status != null) return | |
console.log("tweet") | |
console.log(tweet.text) | |
let owod = owo(tweet.text) | |
console.log(owod) | |
if(tweet.text == owod) return | |
//Create permalink | |
var nameID = tweet.id_str; | |
let permalink = "https://twitter.com/" + tweet.user.screen_name + "/status/" + nameID | |
var name = tweet.user.screen_name; | |
// if(!isUsingQuotes){ | |
T.post('statuses/update', {in_reply_to_status_id: nameID, status: '@' + name + " " + owo(tweet.text)}, function(err, data, response) { | |
if(err){ | |
console.log(err) | |
}else if(response){ | |
console.log(response) | |
} | |
}) | |
// }else{ | |
T.post('statuses/update', {status: '@' + name + " " + owo(tweet.text) + " " + permalink }, function(err, data, response) { | |
if(err){ | |
console.log(err) | |
}else if(response){ | |
console.log(response) | |
} | |
}) | |
// } | |
} | |
stream.on('tweet', tweet => { | |
parseTweet(tweet) | |
return false; | |
}); | |
stream.on('disconnect', function (disconn) { | |
console.log('disconnect') | |
}) | |
stream.on('connect', function (conn) { | |
console.log('connecting') | |
}) | |
stream.on('reconnect', function (reconn, res, interval) { | |
console.log('reconnecting. statusCode:', res.statusCode) | |
}) | |
console.log("Running") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment