Comments (23)
Hi @LeonardoDavid I am glad you like it. Be careful how you use it or you get shut down by Twitter instantly.
- Just remove the code for the media upload in reply.js.
- The database is a blacklist of Twitter users. You may add users yourself beforehand. Or what kind of white-/blacklist are you looking for?
- You would need to extend the code to add a
geocode
parameter like forlang
.
Hope that helps.
from twitter-reply-bot.
Hi, analog-nico Thanks for your replay
i have few more doubts
- i am running this bot on my windows pc, right now i am able to run only one bot at a time is it Possible to run more than one bot at a time. i created a new bot for a different twitter account when i run it i get this error message.
events.js:85
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at Server._listen2 (net.js:1156:14)
at listen (net.js:1182:10)
at net.js:1280:9
at dns.js:85:18
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
2.How to deploy this bot to google cloud
from twitter-reply-bot.
Regarding 1 just remove this code and then you can run multiple bots locally.
Regarding 2 you have to find out yourself I am afraid of.
from twitter-reply-bot.
Hi, Thanks for the answers,
to prevent the Bot from reaching twitter api rate limits, i think we can add muliple api keys and rotate the Api keys every 15 minutes the bot runs is it Possible if yes, can you tell me how
from twitter-reply-bot.
Please read the Don't spam! section of the README. It links important sources that allow you to decide if you are heading in the right direction.
As far as I can tell you are underestimating Twitter's spam detection mechanisms and want to push the amount of replies too far. For that I can no longer be your accomplice. I am sorry.
from twitter-reply-bot.
i am not trying to spam anyway thank you for your time
from twitter-reply-bot.
It is good to hear that you have good intentions. Happy coding!
from twitter-reply-bot.
i am learning to code for about an year i am beginner in Python and JavaScript, could suggest me any tutorial for the last question i asked you
from twitter-reply-bot.
Mmh, good question. I learned a lot from the free material of https://teamtreehouse.com back in the day. If you sign on for a free trial you may find good courses about node.js. Or ask Reddit.
from twitter-reply-bot.
Hey buddy, if you promise me you don't spam then you may find the answer to key rotation in this issue: #2
from twitter-reply-bot.
Hi,
Thank you
from twitter-reply-bot.
i wanted to Post Tweets Without Images, like you said i removed Media Upload code in replay.js
but i am getting a error when i am running this
here is the Error Message
Unhandled rejection TypeError: Cannot read property 'text' of undefined
at compileTweet (C:\Users\LEONARDO\Desktop\bot\nodejs\Tester\lib\responses.js:10:38)
at Object.module.exports.getNextTweet (C:\Users\LEONARDO\Desktop\bot\nodejs\Tester\lib\responses.js:30:16)
at C:\Users\LEONARDO\Desktop\bot\nodejs\Tester\server.js:66:43
at tryCatcher (C:\Users\LEONARDO\Desktop\bot\nodejs\Tester\node_modules\request-promise\node_modules\bluebird\js\main\util.js:26:23)
at Promise._settlePromiseFromHandler (C:\Users\LEONARDO\Desktop\bot\nodejs\Tester\node_modules\request-promise\node_modules\bluebird\js\main\promise.js:507:31)
at Promise._settlePromiseAt (C:\Users\LEONARDO\Desktop\bot\nodejs\Tester\node_modules\request-promise\node_modules\bluebird\js\main\promise.js:581:18)
at Async._drainQueue (C:\Users\LEONARDO\Desktop\bot\nodejs\Tester\node_modules\request-promise\node_modules\bluebird\js\main\async.js:128:12)
at Async._drainQueues (C:\Users\LEONARDO\Desktop\bot\nodejs\Tester\node_modules\request-promise\node_modules\bluebird\js\main\async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\LEONARDO\Desktop\bot\nodejs\Tester\node_modules\request-promise\node_modules\bluebird\js\main\async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:367:17)
Here is my reply.js code
'use strict';
var BPromise = require('bluebird');
var Twitter = require('twitter');
var client = new Twitter(require('../settings.json').twitter_api);
module.exports = function (compiledTweet) {
return new BPromise(function (resolve, reject) {
var data = require('fs').readFileSync(compiledTweet.image);
if (err) {
reject(err);
return;
}
console.dir(media);
if (!media || !media.media_id_string) {
reject(new Error('Image upload failed.'));
return;
}
var status = {
in_reply_to_status_id: compiledTweet.replyTo,
status: compiledTweet.text,
media_ids: media.media_id_string
};
client.post('statuses/update', status, function (err, tweet, response){
if (err) {
reject(err);
} else {
console.dir(tweet);
resolve(tweet);
}
});
});
};
from twitter-reply-bot.
"Cannot read property 'text' of undefined" means that you access the property .text
of a variable that is undefined
. If you search your code for "text" you find "compiledTweet.text". That means compiledTweet
is undefined
.
from twitter-reply-bot.
hi, can you give me link to the Twitter API Library you used
from twitter-reply-bot.
https://www.npmjs.com/package/twitter
from twitter-reply-bot.
Hi,
to import random twitter API Keys i replaced credential code in request.js
var twitter_api= require('../settings.json').twitter_api;
var credentials = twitter_api[Math.floor(Math.random()*twitter_api.length)];
But i am getting this error
Unhandled rejection Error: [object Object]
from twitter-reply-bot.
You may use process.on('unhandledRejection', ...)
to catch the rejection and look into its cause.
from twitter-reply-bot.
Hey, Thanks for Helping,
Sorry, i did not posted full error messages last time These are the errors i am getting
Unhandled rejection Error: [object Object]
at Object.ensureErrorObject (C:\Users\LEONARDO\Desktop\TwitterApp\node_modules\request-promise\node_modules\bluebird\js\main\util.js:261:20)
at Promise._rejectCallback (C:\Users\LEONARDO\Desktop\TwitterApp\node_modules\request-promise\node_modules\bluebird\js\main\promise.js:469:22)
at Promise._settlePromiseFromHandler (C:\Users\LEONARDO\Desktop\TwitterApp\node_modules\request-promise\node_modules\bluebird\js\main\promise.js:513:17)
at Promise._settlePromiseAt (C:\Users\LEONARDO\Desktop\TwitterApp\node_modules\request-promise\node_modules\bluebird\js\main\promise.js:581:18)
at Async._drainQueue (C:\Users\LEONARDO\Desktop\TwitterApp\node_modules\request-promise\node_modules\bluebird\js\main\async.js:128:12)
at Async._drainQueues (C:\Users\LEONARDO\Desktop\TwitterApp\node_modules\request-promise\node_modules\bluebird\js\main\async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\LEONARDO\Desktop\TwitterApp\node_modules\request-promise\node_modules\bluebird\js\main\async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:367:17)
i searched google found solution for few but i dont know which code i need to change
from twitter-reply-bot.
Granted, the stack trace doesn't help. The issue is that somewhere in the context of a Promise
an Error
is thrown. The Promise
, however, has no .catch(...)
handler. Thus an "unhandled rejection" is produced.
If you can solve this you definitely improved your JavaScript skills by a big step!
from twitter-reply-bot.
can you tell me which code and which line i need to fix
from twitter-reply-bot.
Take that as a challenge to improve your skills. You can do it!
Best way to approach this is to get a debugger running. Webstorm contains a very user friendly one.
from twitter-reply-bot.
HI,
i have been trying for 2 days i still cant figure out whats wrong. i think my code for importing random keys might be wrong
is the code is right or wrong
'use strict';
var request = require('request-promise');
var _ = require('lodash');
//var credentials = require('../settings.json').twitter_api;
var twitter_api= require('../settings.json').twitter_api;
var credentials = twitter_api[Math.floor(Math.random()*twitter_api.length)];
function getRequestOptions(options, includeUserToken) {
_.assign(options, {
oauth: {
consumer_key: credentials.consumer_key,
consumer_secret: credentials.consumer_secret
},
headers: {
'Accept': '*/*',
'Connection': 'close',
'User-Agent': 'node.js'
},
json: true
});
if (includeUserToken) {
_.assign(options.oauth, {
token: credentials.access_token_key,
token_secret: credentials.access_token_secret
});
}
return options;
}
module.exports = function (options, includeUserToken) {
options = getRequestOptions(options, includeUserToken);
return request(options);
};
from twitter-reply-bot.
Since your random key importing works well - I tested it - the error is produced somewhere else.
Whatever your error is it should have been caught here. I get the impression you somehow changed the code in other parts that at least screwed the promise chains up so that the error doesn't get caught properly but instead results in an Unhandled rejection
.
To get more insights into your error add these lines to server.js
right below the require
statements:
BPromise.onPossiblyUnhandledRejection(function (err) {
console.dir(err);
});
Instead of "Error: [object Object]"
you should see now the contents of the object. Or even better, use your debugger, put a breakpoint on the console.dir
line, and take a closer look at err
when the execution stops there.
Use your debugger to step through everything and with that zero in on the cause! If you want to improve your debugging skill in general this book is a real gem: https://www.amazon.com/Debugging-David-J-Agans-ebook/dp/B002H5GSZ2 It is one of a handful books which really stand out from all the books I read in my life!
from twitter-reply-bot.
Related Issues (4)
- how do i do the query? HOT 2
- How to import Random Settings HOT 5
- Different queries HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twitter-reply-bot.