-
-
Save EsteveSegura/11114b497a7d6050a3041f0f66766b66 to your computer and use it in GitHub Desktop.
tfi and sample structure
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
const tfi = require('tools-for-instagram'); | |
//tfi doing login | |
let ig = await login(); | |
//hashtags on which we are going to act | |
const hashtags =[ | |
"vegan", | |
"vegetarian", | |
"govegan", | |
"veganfood", | |
"organic", | |
] | |
//We create schedules in which our bot will have activity | |
const intervals = { schedulesOfTheDay: [ | |
{startHour: 08, startMinute: 00, action: "likes"}, | |
{startHour: 10, startMinute: 00, action: "likes"}, | |
{startHour: 13, startMinute: 00, action: "likes"}, | |
{startHour: 16, startMinute: 00, action: "likes"}, | |
{startHour: 20, startMinute: 00, action: "likes"}, | |
{startHour: 23, startMinute: 00, action: "likes"}, | |
{startHour: 17, startMinute: 00, action: "uploadPhoto"} | |
]} | |
//We start our interval | |
setInterval(async() => { | |
//Every time our interval is executed we get the hour and minute | |
let currentDate = new Date() | |
let getHour = currentDate.getHours(); | |
let getMinutes = currentDate.getMinutes(); | |
/* | |
We check the list of our schedules and compare | |
it with the current time, if our schedule and | |
the current time is the same we execute the action | |
*/ | |
intervals.schedulesOfTheDay.forEach(time => { | |
if(getHour == time.startHour && getMinutes == time.startMinute && time.action == "likes"){ | |
//This is where we are going to give likes in certain hashtags | |
} | |
if(getHour == time.startHour && getMinutes == time.startMinute && time.action == "uploadPhoto"){ | |
//This is where we are going to upload photos to instagram | |
} | |
}); | |
//This is the parameter of our interval, which is at 60000ms ( 1 minute ) | |
}, 60000); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment