Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Clone in Desktop Download ZIP
Tree: 7c81a9426c
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (29 sloc) 891 Bytes
Twit = require 'twit'
config = require './config.json'
wikichanges = require 'wikichanges'
# listen for Wikipedia changes
wikipedia = new wikichanges.WikiChanges(ircNickname: config.nick)
# configure Twitter client
twitter = new Twit config
# ranges from https://en.wikipedia.org/wiki/Wikipedia:Congressional_staffer_edits
ipRanges = [
# House of Representatives
/143\.228\.\d+\.\d+/,
/143\.231\.\d+\.\d+/
# Senate
/156\.33\.\d+\.\d+/
# Verizon for testing from home
/96\.241\.\d+\.\d+/
]
# send out a tweet
tweet = (edit) ->
text = edit.page + ' Wikipedia article edited anonymously by Congress ' + edit.url
twitter.post 'statuses/update', status: text, (err, data, response) ->
if err
console.log err
# listen for edits
wikipedia.listen (change) ->
if change.anonymous
for range in ipRanges
if change.user.match(range)
tweet(change)
Jump to Line
Something went wrong with that request. Please try again.