How To Make Twitter Bot – Twitter Account Creator Bot
You can simply write a Twitter larva with the assistance of Google Apps Script. It fetches tweets self-addressed to the larva through the Twitter API.
- Lets Create a Twitter App at apps.twitter.com and dont forget, note the Twitter Consumers Keys and Access Tokens
- Go to developer.wolfram.com, produce associate degree account screenshot and so opt for “Get associate degree App ID” to make your new app. we’ll would like this App ID within the Google Script. Your free atomic number 74 Alpha App will solely be used for a non-commercial purpose.
- Edit the values of TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, TWITTER_ACCESS_TOKEN, TWITTER_ACCESS_SECRET, TWITTER_HANDLE (your Twitter account) and WOLFRAM_API_ID
- Go to Run -> Start to initialize the Twitter bot. When asked u; Lets say yes if the script requires you to authorize access to certain Google services.
The code is prepared to tho’ you’ll ought to produce a metallic element App and conjointly embrace the Twitter library in your Google Scripts project (key is MKvHYYdYA4G5JJHj7hxIcoh8V4oX7X1M_) with the symbol set to Twitter.
Twitter Account Creator Bot Open Source Codes;
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 | /* Twitter Bot written by Amit Agarwal */ function Start() { var props = PropertiesService.getScriptProperties(); props.setProperties({ TWITTER_CONSUMER_KEY: TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET: TWITTER_CONSUMER_SECRET, TWITTER_ACCESS_TOKEN: TWITTER_ACCESS_TOKEN, TWITTER_ACCESS_SECRET: TWITTER_ACCESS_SECRET, MAX_TWITTER_ID: 0 }); // Delete exiting triggers, if any var triggers = ScriptApp.getProjectTriggers(); for (var i = 0; i < triggers.length; i++) { ScriptApp.deleteTrigger(triggers[i]); } // Setup a time-based trigger for the Bot to fetch and process incoming Tweets // every minute. If your Google Script is running out of quota, change the // time to 5 or 10 minutes though the bot won't offer real-time answers then. ScriptApp.newTrigger("labnol_twitterBot") .timeBased() .everyMinutes(1) .create(); } /* For help, email amit@labnol.org or visit http://ctrlq.org */ function labnol_twitterBot() { try { var props = PropertiesService.getScriptProperties(), twit = new Twitter.OAuth(props); // Are the Twitter access tokens are valid? if (twit.hasAccess()) { var tweets = twit.fetchTweets("to:" + TWITTER_HANDLE, function(tweet) { // Ignore tweets that are sensitive (NSFW content) if (!tweet.possibly_sensitive) { var question = tweet.text.toLowerCase().replace("@" + TWITTER_HANDLE, "").trim(), answer = askWolframAlpha_(question); if (answer) { return { answer: "@" + tweet.user.screen_name + " " + answer, id_str: tweet.id_str }; } } }, { multi: true, lang: "en", // Fetch only English tweets count: 5, // Process 5 tweets in a batch since_id: props.getProperty("MAX_TWITTER_ID") }); if (tweets.length) { // The MAX_TWITTER_ID property store the ID of the last tweet answered by the bot props.setProperty("MAX_TWITTER_ID", tweets[0].id_str); // Process the tweets in FIFO order for (var i = tweets.length — 1; i >= 0; i--) { // The bot replies with an answer twit.sendTweet(tweets[i].answer, { in_reply_to_status_id: tweets[i].id_str }); // Wait a second to avoid hitting the rate limits Utilities.sleep(1000); } } } } catch (f) { // You can also use MailApp to get email notifications of errors. Logger.log("Error: " + f.toString()); } } function askWolframAlpha_(q, app) { try { var api = "http://api.wolframalpha.com/v2/query?podindex=2&format=plaintext&appid=" + WOLFRAM_APP_ID + "&input=" + encodeURIComponent(q); var response = UrlFetchApp.fetch(api, { muteHttpException: true }); // Parse the XML response if (response.getResponseCode() == 200) { var document = XmlService.parse(response.getContentText()); var root = document.getRootElement(); if (root.getAttribute("success").getValue() === "true") { return root.getChild("pod").getChild("subpod").getChild("plaintext").getText(); } } } catch (f) {} return false; } |
Bankruptcy lawyer Loveland. Los angeles bankruptcy loomisgreene.com. https://muhomor.red как хранить сушеные мухоморы.