Browse Source

Import latest version

master
Bernhard Fröhlich 4 years ago
commit
9a30b24dbc
3 changed files with 85 additions and 0 deletions
  1. 6
    0
      README.md
  2. 35
    0
      package.json
  3. 44
    0
      server.js

+ 6
- 0
README.md View File

@@ -0,0 +1,6 @@
## redportsircbot

IRC relay bot for buildlogs with an HTTP interface.

Beware this needs node.js and was running on openshift before they went commercial.


+ 35
- 0
package.json View File

@@ -0,0 +1,35 @@
{
"name": "redportsircbot",
"version": "1.0.1",
"description": "redports.org IRC Bot for Buildlogs",
"keywords": [
"OpenShift",
"Node.js",
"application",
"openshift"
],
"author": {
"name": "decke",
"email": "decke@bluelife.at",
"url": "http://www.redports.org/"
},
"homepage": "http://www.redports.org/",
"repository": {
"type": "git",
"url": "https://github.com/openshift/origin-server"
},
"engines": {
"node": ">= 0.6.0",
"npm": ">= 1.0.0"
},
"dependencies": {
"cloud-env": "^0.1.0",
"express": "~4.12.3",
"http": "0.0.0",
"irc": "~0.3.11"
},
"devDependencies": {},
"bundleDependencies": [],
"private": true,
"main": "server.js"
}

+ 44
- 0
server.js View File

@@ -0,0 +1,44 @@
#!/bin/env node

var token = "YOUR-SECRET-TOKEN-HERE";

var channels = ["#redports-buildlog"];

var ipaddr = process.env.NODEJS_IP || "127.0.0.1";
var port = process.env.NODEJS_PORT || 8080;

var irc = require("irc");
var http = require("http");
var url = require("url");

var bot = new irc.Client(
"irc.freenode.net",
"redports",
{
channels: channels,
port: 8001,
debug: true,
showErrors: true,
floodProtection: true
}
);

var server = http.createServer(function (request, response) {
if(url.parse(request.url, true).query.token && url.parse(request.url, true).query.msg) {
if(url.parse(request.url, true).query.token == token) {
console.log("Sending: %s", url.parse(request.url, true).query.msg);
bot.say(channels[0], url.parse(request.url, true).query.msg);
}
else {
console.log("Invalid token");
}
}

response.writeHead(200, {"Content-Type": "text/plain"});
response.end(".");
});

server.listen(port, ipaddr);

console.log("Listening on %s:%d ...", ipaddr, port);


Loading…
Cancel
Save