• Stars
    star
    225
  • Rank 173,670 (Top 4 %)
  • Language
    JavaScript
  • Created about 11 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple example Twitter bot using NodeJS.

ExampleBot

This bot retweets the latest tweet using the "#mediaarts" hashtag. It attempts to retweet once per hour.

Note: you must be comfortable using your computer's command line interface to use this bot. If you've never used it, there are tutorials for macOS and Windows.

Installation

If you don't already have have them, please install Node.js. This will install two programs: node, which runs JavaScript from the command line, and npm, which helps you install software that Node.js can run.

Make an empty project directory somewhere convenient for you, download the archive zip file, and unzip the contents to your project directory. Go to your project directory in the command line. There should be four files there: .gitignore, README.md, bot.js and config.js. In that directory type:

npm install twit

This installs some code to the npm_modules subdirectory, which you don't need to worry about. (It's Twit, the library that lets us talk to Twitter.)

Connecting to Twitter

At this point you need to register a Twitter account and also get its "app info".

So create a Twitter account for whatever account you want to tweet this stuff. Twitter doesn't allow you to register multiple twitter accounts on the same email address. I recommend you create a brand new email address (perhaps using Gmail) for the Twitter account. Once you register the account to that email address, wait for the confirmation email. Then go here and log in as the Twitter account for your bot:

https://apps.twitter.com/app/new

Once you're there, fill in the required fields: name, description, website. None of it really matters at all to your actual app, it's just for Twitter's information. Do the captcha and submit.

Next you'll see a screen with a "Details" tab. Click on the "Settings" tab and under "Application Type" choose "Read and Write", then hit the update button at the bottom.

Then go to the Keys and Access Tokens tab, and at the bottom click "create my access token". Nothing might happen immediately. Wait a minute and reload the page. then there should be "access token" and "access token secret", which are both long strings of letters and numbers.

Now use a text editor to open up the "config.js" file. It should look like this:

module.exports = {
  consumer_key:         'blah',
  consumer_secret:      'blah',
  access_token:         'blah',
  access_token_secret:  'blah'
}

In between those quotes, instead of 'blah', paste the appropriate info from the Details page. This is essentially the login information for the app.

Now type the following in the command line in your project directory:

node bot.js

Hopefully at this point you see a message like "Success! Check your bot, it should have retweeted something." Check the Twitter account for your bot, and it should have retweeted a tweet with the #mediaarts hashtag.

More Repositories

1

corpora

A collection of small corpuses of interesting data for the creation of bots and similar stuff.
JavaScript
4,877
star
2

express-activitypub

A very simple reference implementation of an ActivityPub server using Express.js
JavaScript
585
star
3

rss-to-activitypub

An RSS to ActivityPub converter.
JavaScript
551
star
4

NaNoGenMo-2015

National Novel Generation Month, 2015 edition.
341
star
5

twitter-archiver

Make your own simple, public, searchable Twitter archive
JavaScript
296
star
6

NaNoGenMo-2014

National Novel Generation Month, 2014 edition.
258
star
7

wordfilter

A small module meant for use in text generators that lets you filter strings for bad words.
Python
220
star
8

metaphor-a-minute

Metaphor a Minute! You too can write an annoying philosophy twitter bot.
JavaScript
210
star
9

NaNoGenMo

National Novel Generation Month. Because.
184
star
10

ja2

The source code for Jagged Alliance 2. I didn't write this; see the Strategy First license agreement for details. Supplementary material for the Jagged Alliance 2 Boss Fight Book.
C
112
star
11

rapbot

JavaScript
64
star
12

grunt-init-twitter-bot

A grunt init template for making Twitter bots, preloaded with some useful libs.
JavaScript
60
star
13

ea-thesaurus

The Edinburgh Associative Thesaurus (EAT) is a set of word association norms showing the counts of word association as collected from subjects.
45
star
14

sorting-bot

The Sorting Hat Bot (@SortingBot on Twitter)
JavaScript
40
star
15

twoheadlines

@twoheadlines
CSS
38
star
16

latourswag

Bruno Latour + #swag = Twitter bot!
JavaScript
33
star
17

gender-probability

Providing gender probabilities for US/UK names using Open Gender Tracker's [Global Name Data](https://github.com/OpenGenderTracking/globalnamedata) resource.
JavaScript
27
star
18

TheEthicalAdBlocker

This browser extension provides a 100% guaranteed ethical ad blocking experience.
JavaScript
25
star
19

gaunt

Simple, versatile, achingly beautiful.
JavaScript
24
star
20

spewer

A reverse part-of-speech tagger. Give it a list of tags and it spews out matching language.
JavaScript
23
star
21

gutencorpus

This is a simple tool that lets you search the top 100-ish Project Gutenberg ebooks for text.
JavaScript
21
star
22

projects

A listing of my projects.
JavaScript
20
star
23

reverseocr

A bot that attempts to draw words.
JavaScript
19
star
24

wordnik-bb

A node.js interface to the Wordnik API, which lets you get dictionary definitions, random words, pronunciation, and more!
JavaScript
18
star
25

bracket-meme-bot

A bot that make "bracket memes".
JavaScript
16
star
26

farewell

Employee farewell letter generator.
JavaScript
16
star
27

museumbot

Tweeting the Met.
JavaScript
16
star
28

roof-slapping-bot

*slaps roof of source code* this bad boy can fit so many bugs in it
JavaScript
12
star
29

painterly-textures

JavaScript
11
star
30

harpooneers

Code for "HARPOONEERS AND SAILORS", a novel I generated for NaNoGenMo 2015.
JavaScript
10
star
31

mastodon-autoreply

A bot that replies to new followers, ideally saying "I've moved! Follow me (here)."
JavaScript
10
star
32

outslide

A random slide generator. I'm sorry.
JavaScript
10
star
33

grunt-init-textgen

A grunt-init template for text generating pages with twitter/link sharing.
JavaScript
10
star
34

teamsnake-simple

Early network build of Team Snake.
JavaScript
8
star
35

tweetYourArchive

Set up a bot to tweet your twitter archive, on a delay.
JavaScript
8
star
36

cyberfiction

It was the best of cybertimes, it was the worst of cybertimes.
JavaScript
7
star
37

hottestStartups

Really hot startup ideas.
JavaScript
7
star
38

very-simple-whiteboard

Very simple whiteboard, tuned for a Chrome Pixel.
JavaScript
6
star
39

corpora-project

This is the NPM package to access the latest corpora data.
JavaScript
5
star
40

wordnik-hackathon

The Wordnik / Bot Summit Hackathon
5
star
41

overzealous-autocomplete

Overzealous autocomplete.
JavaScript
5
star
42

chum-corpus

Occasionally updated chumbox images and headlines.
4
star
43

youMustBe

Software, you must be a generator because you are a thing that generates output.
JavaScript
4
star
44

intersections

Venn Diagrams.
JavaScript
3
star
45

dialogue

Generative dialogue.
JavaScript
3
star
46

allthethings

Verb ALL the nouns!
JavaScript
3
star
47

amen-chopper

This is a little toy that takes the Amen Break and chops it up into slices of different lengths and offsets, playing the slices in random order at a certain bpm and running the whole thing through a filter. You can get very different beats just by adjusting these few settings.
JavaScript
2
star
48

slowtext

s l o w w w w t e x t
JavaScript
2
star
49

4myrealfriends

Source code for my real friends, real code for my source friends.
JavaScript
2
star
50

wolf3d

wolf3d hacks
JavaScript
2
star
51

lastwords

Last words of executed Texas death row inmates that contain "love".
JavaScript
2
star
52

pennyarcade

JavaScript
2
star
53

integers

29 Positive Integers Under 30
1
star
54

documentationPlayground

CSS
1
star
55

netboard-server

JavaScript
1
star
56

dariusbots

An account that RTs tweets from my twitter list that reach a certain number of favs+RTs.
JavaScript
1
star
57

netboard

JavaScript
1
star
58

lmmtfy

Let Me Moogle That For You
JavaScript
1
star
59

TwineOnline

Web-based port of Twine
JavaScript
1
star
60

fmk

Fuck, marry, or kill? A Twitter bot.
JavaScript
1
star
61

doctorwhat

Doctor Who speculation generator.
JavaScript
1
star
62

ao3

God help me.
JavaScript
1
star
63

gengen

HTML
1
star
64

jqProclamations

everything is the jQuery of everything
JavaScript
1
star
65

gqTest

gameQuery test project
1
star
66

generateShare

A template I can use for generators that has twitter sharing built in
JavaScript
1
star
67

ColorSprite

Grab colors from an image using Color Thief, create a sprite. Proof of concept.
JavaScript
1
star
68

spinny-machine

A spinny machine.
JavaScript
1
star
69

fuckvideogames

Fuck videogames.
JavaScript
1
star