Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the IRC channel, nick, and URL to be specified in environment variables #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions accidentalbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ var sugar = require('sugar');
var irc = require('irc');
var webSocket = require('ws');

var channel = '#atp';
var webAddress = 'http://www.caseyliss.com/showbot';
var channel = process.env.IRC_CHANNEL || '#atp';
var nick = process.env.IRC_NICK || 'accidentalbot';
var webAddress = process.env.CLIENT_URL || 'http://www.caseyliss.com/showbot';
var TITLE_LIMIT = 75;

var titles = [];
Expand Down Expand Up @@ -63,7 +64,7 @@ function handleSendVotes(from, message) {
client.say(from, 'Three most popular titles:');
for (var i = 0; i < titlesByVote.length; ++i) {
var votes = titlesByVote[i]['votes'];
client.say(from, titlesByVote[i]['votes'] + ' vote' + (votes != 1 ? 's' : '') + ': " ' + titlesByVote[i].title + '"');
client.say(from, titlesByVote[i]['votes'] + ' vote' + (votes != 1 ? 's' : '') + ': "' + titlesByVote[i].title + '"');
}
}

Expand Down Expand Up @@ -98,7 +99,7 @@ function handleHelp(from) {
client.say(from, 'To see titles/links, go to: ' + webAddress);
}

var client = new irc.Client('irc.freenode.net', 'accidentalbot', {
var client = new irc.Client('irc.freenode.net', nick, {
channels: [channel]
});

Expand Down