mirror of
https://github.com/RGBCube/TwitterDiscordWebhook
synced 2025-07-27 13:07:45 +00:00
fixes to only support tweets, and for uptime
This commit is contained in:
parent
a47e8a1f34
commit
5579d41cf4
1 changed files with 18 additions and 2 deletions
18
main.js
18
main.js
|
@ -24,8 +24,24 @@ tClient.get('account/verify_credentials', { skip_status: true })
|
|||
var stream = tClient.stream('statuses/filter', { follow: `${config.user_id}` })
|
||||
console.log(`Fetching tweets from id: ${config.user_id}`)
|
||||
|
||||
stream.on('connected', function (response) {
|
||||
console.log(`Connected to twitter`)
|
||||
})
|
||||
|
||||
stream.on('tweet', function (tweet) {
|
||||
if(tweet.retweeted_status) return
|
||||
if(tweet.retweeted_status || tweet.in_reply_to_status_id || tweet.is_quote_status) return
|
||||
let twitterLink = `https://twitter.com/${tweet.user.screen_name}/status/${tweet.id_str}`
|
||||
wClient.send(`${config.webhook_message} ${twitterLink}`)
|
||||
})
|
||||
|
||||
stream.on('disconnect', function (disconnectMessage) {
|
||||
console.log(`Disconnected from twitter`)
|
||||
})
|
||||
|
||||
stream.on('reconnect', function (request, response, connectInterval) {
|
||||
console.log(`reconnecting to twitter`)
|
||||
})
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.log("something happened!", err);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue