mirror of
https://github.com/OPSnet/GithubBot.git
synced 2026-01-16 18:04:19 -05:00
second commit
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
node_modules/
|
||||
settings.json
|
||||
|
||||
14
server.js
14
server.js
@@ -1,4 +1,17 @@
|
||||
const fastify = require('fastify')();
|
||||
const irc = require('irc-upd');
|
||||
|
||||
const settings = require('./settings');
|
||||
|
||||
const client = new irc.Client('irc.orpheus.network', settings.username, {
|
||||
channels: settings.channels
|
||||
});
|
||||
|
||||
client.addListener('registered', () => {
|
||||
if (settings.nickserv) {
|
||||
client.say('nickserv', `IDENTIFY ${settings.nickserv}`);
|
||||
}
|
||||
});
|
||||
|
||||
fastify.get('/', async (req, reply) => {
|
||||
return { hello: 'world' }
|
||||
@@ -7,6 +20,7 @@ fastify.get('/', async (req, reply) => {
|
||||
fastify.post('/', async (req, reply) => {
|
||||
console.log(req.body['test']);
|
||||
console.log(req.headers);
|
||||
client.say('#develop', `New Github Event from ${sender.login}`);
|
||||
return { message: 'posted' };
|
||||
});
|
||||
|
||||
|
||||
7
settings.json.sample
Normal file
7
settings.json.sample
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"username": "GithubBot",
|
||||
"nickserv": "some_long_string",
|
||||
"channels": [
|
||||
"#develop"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user