-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoogleBot.js
More file actions
49 lines (44 loc) · 1.86 KB
/
googleBot.js
File metadata and controls
49 lines (44 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
console.log('Replier Bot Starting!')
var Twit = require('twit');
var config = require('./configTwit');
var T = new Twit(config);
const myAccount = '1369045150907858946' || '1354887782737580033' || '936495688434696192' || '871067546807672832' || '257245904'; //Ur account ID, add your bot account id here so it doesnt reply to itself
var totalTweets = 1;
googlebot();
setInterval(googlebot,1000*3600);
function googlebot(){
//Setting up a user stream
var stream = T.stream('statuses/filter', { track: 'brave' }); //this is where your main keyword goes
stream.on('tweet', function (tweet) {
var username = tweet.user.screen_name;
var statusTweet = "Hey @" + username + ", On the topic of brave, why don't you try Presearch? It's a privacy-focused, decentralized search engine. (This Tweet was generated by PresearchBot) http://bit.ly/PresearchAlex"; //This where you text reply goes
const id = tweet.id_str;
const text = tweet.text;
const params = {
in_reply_to_status_id: id,
status : statusTweet,
auto_populate_reply_metadata: true
}
//This is where you need to check further. You can add more conditions here
if(tweet.user.id != myAccount && ( text.includes('brave search') || text.includes('brave browser')
// (text.includes('google search it') || text.includes('google that') || text.includes('google that')
))
{
console.log(tweet.text);
T.post('statuses/update', params, tweeted);
function tweeted(err, data, response)
{
console.log('Tweet Attempt');
if(err)
{
console.log(err);
}
else
{
console.log('Tweet Sent!');
if(totalTweets == 10) { stream.stop(); } else { totalTweets += 1; }
}
}
}
})
}