gtfo chanserv
This commit is contained in:
parent
285b97f798
commit
2e4d132963
21
src/events/join.js
Normal file
21
src/events/join.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
module.exports = (bot, lib) => {
|
||||
bot.on('join', (e) => {
|
||||
bot.whois(e.user.getNick(), e.network, (err, data) => {
|
||||
if(data.account !== null) {
|
||||
lib.getUserlevel(e.user.getNick(), e.network, e.channel, (cb) => {
|
||||
var modes = false;
|
||||
if(cb.level >= 70)
|
||||
modes = "+ao";
|
||||
else if(cb.level >= 60)
|
||||
modes = "+o";
|
||||
else if(cb.level >= 50)
|
||||
modes = "+h";
|
||||
else if(cb.level >= 10)
|
||||
modes = "+v";
|
||||
if(modes !== false)
|
||||
bot.mode(e.channel, modes + (' '+e.user.getNick()).repeat(modes.length-1), e.network);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
10
src/lib.js
10
src/lib.js
|
@ -35,6 +35,7 @@ function Lib(tbot, tsql) {
|
|||
console.log((cb)?"Admins wurden geladen":"Admins konnten nicht geladen werden");
|
||||
});
|
||||
Lib.prototype.loadTrigger();
|
||||
Lib.prototype.loadEvents();
|
||||
}
|
||||
|
||||
|
||||
|
@ -161,3 +162,12 @@ Lib.prototype.loadTrigger = () => {
|
|||
}
|
||||
});
|
||||
};
|
||||
Lib.prototype.loadEvents = () => {
|
||||
var files = fs.readdirSync(__dirname+'/events/');
|
||||
files.forEach((file) => {
|
||||
if(file.substr(-3, 3) === '.js') {
|
||||
console.log('Loading event', file);
|
||||
require(__dirname+'/events/' + file)(bot, Lib.prototype);
|
||||
}
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue
Block a user