parent
d05c59c896
commit
577612cee5
|
@ -1,4 +1,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
media
|
site
|
||||||
build/**
|
build/**
|
||||||
lib/inspircd-*
|
lib/inspircd-*
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import irc = require('irc');
|
import * as irc from "irc";
|
||||||
|
|
||||||
function chanReg(channel: string, owner: string){
|
function chanReg(channel: string, owner: string){
|
||||||
var bot = new irc.Client('127.0.0.1', 'ChanReg', {
|
let bot = new irc.Client('127.0.0.1', 'ChanReg', {
|
||||||
channels: ['#ChanReg'],
|
channels: [''],
|
||||||
userName: 'ChanReg',
|
userName: 'ChanReg',
|
||||||
realName: 'Channel Registration Bot',
|
realName: 'Channel Registration Bot',
|
||||||
floodProtection: false,
|
floodProtection: false,
|
||||||
});
|
});
|
||||||
bot.addListener('registered', (message) => {
|
bot.once('registered', (message) => {
|
||||||
bot.send('OPER', 'admin', 'test');
|
bot.send('OPER', 'admin', 'test');
|
||||||
bot.join(channel);
|
bot.join(channel);
|
||||||
bot.send('MODE', channel, '+P');
|
bot.send('MODE', channel, '+P');
|
||||||
|
@ -17,17 +17,19 @@ function chanReg(channel: string, owner: string){
|
||||||
}
|
}
|
||||||
|
|
||||||
function chanUnReg(channel: string){
|
function chanUnReg(channel: string){
|
||||||
var bot = new irc.Client('127.0.0.1', 'ChanReg', {
|
let bot = new irc.Client('127.0.0.1', 'ChanReg', {
|
||||||
channels: [''],
|
channels: [''],
|
||||||
userName: 'ChanReg',
|
userName: 'ChanReg',
|
||||||
realName: 'Channel Registration Bot',
|
realName: 'Channel Registration Bot',
|
||||||
floodProtection: false,
|
floodProtection: false,
|
||||||
debug: true
|
debug: true
|
||||||
});
|
});
|
||||||
bot.addListener('registered', (message) => {
|
bot.once('registered', (message) => {
|
||||||
bot.send('OPER', 'admin', 'test');
|
bot.send('OPER', 'admin', 'test');
|
||||||
bot.join(channel);
|
bot.join(channel);
|
||||||
bot.send('MODE', channel, '-P');
|
bot.send('MODE', channel, '-P');
|
||||||
bot.disconnect();
|
bot.disconnect();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export {chanReg, chanUnReg};
|
|
@ -1,4 +1,6 @@
|
||||||
import * as mediaserver from "./server";
|
import * as mediaserver from "./server";
|
||||||
|
import * as ircd from "./ircd";
|
||||||
|
|
||||||
function boot(): void{
|
function boot(): void{
|
||||||
const mediaconfig: any = {
|
const mediaconfig: any = {
|
||||||
rtmp: {
|
rtmp: {
|
||||||
|
@ -11,7 +13,7 @@ function boot(): void{
|
||||||
http: {
|
http: {
|
||||||
port:8000,
|
port:8000,
|
||||||
allow_origin: '*',
|
allow_origin: '*',
|
||||||
mediaroot: './media'
|
mediaroot: './site'
|
||||||
},
|
},
|
||||||
trans: {
|
trans: {
|
||||||
ffmpeg: '/usr/bin/ffmpeg',
|
ffmpeg: '/usr/bin/ffmpeg',
|
||||||
|
@ -25,5 +27,6 @@ function boot(): void{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mediaserver.boot(mediaconfig);
|
mediaserver.boot(mediaconfig);
|
||||||
|
ircd.boot();
|
||||||
}
|
}
|
||||||
export { boot };
|
export { boot };
|
|
@ -0,0 +1,20 @@
|
||||||
|
import * as child from "child_process";
|
||||||
|
var ircd: child.ChildProcess;
|
||||||
|
function boot():void{
|
||||||
|
ircd = child.execFile("./lib/inspircd-3.3.0/run/inspircd", ["restart"], (error, stdout, stderr) => {
|
||||||
|
if (error){
|
||||||
|
console.log("[IRCD] Failed to start Inspircd");
|
||||||
|
console.log(stdout);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("[IRCD] Started Inspircd");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadSSL():void{
|
||||||
|
ircd.kill("SIGUSR1");
|
||||||
|
}
|
||||||
|
|
||||||
|
export { boot, reloadSSL };
|
Reference in New Issue