This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbotiana.js
80 lines (61 loc) · 2.05 KB
/
botiana.js
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
console.log("one taught me patience...");
//checking if it's in develop mode for local use
if (process.env.NODE_ENV === "develop") {
require("dotenv").config();
};
//node schedule
const schedule = require("node-schedule");
const rule = new schedule.RecurrenceRule();
rule.hour = 12;
rule.minute = 30;
rule.tz = "Etc/GMT+4";
//march 11, trying to get this to it's own repo :(
// Create an Twitter object to connect to Twitter API
var Twit = require('twit');
// Pulling keys from another file
var config = require('./configB.js');
// Making a Twit object for connection to the API
var T = new Twit(config);
// Setting up a user stream
var stream = T.stream('statuses/filter', { track: '@BotianaGrande' });
// Now looking for tweet events
// See: https://dev.twitter.com/streaming/userstreams
stream.on('tweet', tweetEvent);
// Here a tweet event is triggered!
function tweetEvent(tweet) {
var id = tweet.id_str;
var text = tweet.text;
var name = tweet.user.screen_name;
let regex = /(👀💅)/g;
var str = text;
let godIsAWoman = str.match(regex) || [];
var sevenRings = godIsAWoman.length>0;
console.log(godIsAWoman);
console.log(sevenRings);
//from itsAydrian in twitch chat on 1/28 😘
let i = Math.floor(Math.random() * 3);
// checks text of tweet for mention of Bot
if ((text.includes('@BotianaGrande') && sevenRings === true)) {
// Start a reply back to the sender
var replyText = "@"+ name + " Thank you, next...";
// Post that tweet
T.post('statuses/update', { status: replyText, in_reply_to_status_id: id}, tweeted);
// Make sure it worked!
function tweeted(err, reply) {
if (err) {
console.log(err.message);
} else {
console.log('Tweeted: ' + reply.text);
}
}
} else {
console.log("One taught me pain");
}
}
/*function letsGoGirls()
{
console.log("I don't know a lot of Ariana Grande");
T.post('statuses/update', {status: "...let's go, girls."});
};
const job1 = schedule.scheduleJob(rule, letsGoGirls);
job1.on("tweetIt", letsGoGirls)*/