I'm trying to create an twitter bot wich says good morning and good night every day to my girlfriend, but i'm deepening with this code: 187 error :(
const dotenv = require('dotenv')
const Twitter = require('twitter')
const CronJob = require("cron").CronJob
dotenv.config({ path: './config.env'});
const twitterClient = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_KEY,
access_token_secret: process.env.TWITTER_ACCESS_SECRET
});
const tweet_bomdia = async () =>
twitterClient.post('statuses/update', {status: 'bom dia @nalinhane, boa aula hoje ??'}, function(error, tweet, response) {
if(error) throw error;
})
const tweet_bomdia_segunda = async () =>
twitterClient.post('atualizando', {status: 'bom dia @nalinhane, boa semana e boa aula hoje ??'}, function(error, tweet, response) {
if(error) throw error;
})
const tweet_bomdia_quarta = async () =>
twitterClient.post('statuses/update', {status: 'bom dia @nalinhane, aguenta que já chegamos no meio da semana ???'}, function(error, tweet, response) {
if(error) throw error;
})
const tweet_bomdia_sexta = async () =>
twitterClient.post('statuses/update', {status: 'bom dia @nalinhane, sextooooooouuu bebe ???'}, function(error, tweet, response) {
if(error) throw error;
})
const tweet_bomdia_fds = async () =>
twitterClient.post('statuses/update', {status: 'bom dia @nalinhane, aproveite seu dia ??'}, function(error, tweet, response) {
if(error) throw error;
})
const tweet_boanoite = async () =>
twitterClient.post('statuses/update', {status: 'boa noite @nalinhane , durma bem ??'}, function(error, tweet, response) {
if(error) throw error;
})
const job0 = new CronJob("0 7 * * 2,4", () => {
console.log('Bom dia sendo enviado!')
tweet_bomdia()
})
const job1 = new CronJob("0 7 * * 1", () => {
console.log('Bom dia de segunda sendo enviado!')
tweet_bomdia_segunda()
})
const job2 = new CronJob("0 7 * * 3", () => {
console.log('Bom dia de quarta sendo enviado!')
tweet_bomdia_quarta()
})
job0.start()
job1.start()
job2.start()
And this is the error:
F:ProjetosLaura Botot.js:21
if(error) throw error;
^
[ { code: 187, message: 'Status is a duplicate.' } ]
I really tried everything you can imagine and didn't help.
I've tried to switch the twitter API but it didn't work too.