Initial commit;
This commit is contained in:
commit
88cdc57e54
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
npm-debug.log
|
||||||
|
node_modules/
|
||||||
|
config.js
|
21
config.example.js
Normal file
21
config.example.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
module.exports = {
|
||||||
|
// IRC server to connect to.
|
||||||
|
server: 'chat.freenode.net',
|
||||||
|
|
||||||
|
// List of channels / people to report to.
|
||||||
|
channels: ['#horsejs'],
|
||||||
|
|
||||||
|
// IRC nick/names for the bot
|
||||||
|
nick: 'gitlab-bot',
|
||||||
|
userName: 'gitlab-bot',
|
||||||
|
realName: 'gitlab-bot',
|
||||||
|
|
||||||
|
// Secret as entered in the Gitlab Webhook instance.
|
||||||
|
secret: '12345',
|
||||||
|
|
||||||
|
// Port on which to run.
|
||||||
|
port: 1337,
|
||||||
|
|
||||||
|
// Network interface on which to run the webhook server.
|
||||||
|
hostname: '0.0.0.0'
|
||||||
|
}
|
30
index.js
Normal file
30
index.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
var irc = require('irc');
|
||||||
|
var express = require('express');
|
||||||
|
var bodyParser = require('body-parser');
|
||||||
|
|
||||||
|
var config = require('./config');
|
||||||
|
|
||||||
|
var client = new irc.Client(config.server, config.nick, {
|
||||||
|
//debug: true,
|
||||||
|
channels: config.channels,
|
||||||
|
userName: config.userName,
|
||||||
|
realName: config.realName,
|
||||||
|
retryDelay: 120000
|
||||||
|
});
|
||||||
|
|
||||||
|
var say = client.say.bind(client);
|
||||||
|
|
||||||
|
var app = express();
|
||||||
|
|
||||||
|
app.use(bodyParser.json()); // for parsing application/json
|
||||||
|
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
||||||
|
|
||||||
|
app.post('/', function(req, res) {
|
||||||
|
var body = req.body || {};
|
||||||
|
|
||||||
|
res.sendStatus(200);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(config.port, config.hostname, function() {
|
||||||
|
console.log('gitlab-to-irc running.');
|
||||||
|
});
|
16
package.json
Normal file
16
package.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "jshorse",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "An irc bot that can read horse_javascript tweets and repeat them.",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "Benjamin Bouvier <public@benj.me>",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"body-parser": "^1.15.2",
|
||||||
|
"express": "4.14.0",
|
||||||
|
"irc": "0.3.9"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user