check if registered
This commit is contained in:
parent
a23a4ac903
commit
e87499e705
|
@ -14,27 +14,31 @@ module.exports = (bot, lib) => {
|
||||||
|
|
||||||
if( name in e.channel.names ) {
|
if( name in e.channel.names ) {
|
||||||
bot.whois(name.trim(), e.network, (err, data) => {
|
bot.whois(name.trim(), e.network, (err, data) => {
|
||||||
var host = data.username+'@'+data.hostname;
|
if(data.account !== null) {
|
||||||
if(host in lib.admins) {
|
var host = data.username+'@'+data.hostname;
|
||||||
if(level <= 0) {
|
if(host in lib.admins) {
|
||||||
lib.sql.query('delete from `f0ck`.`user` where `id` = ? limit 1', [lib.admins[host].id], () => {
|
if(level <= 0) {
|
||||||
lib.loadUser();
|
lib.sql.query('delete from `f0ck`.`user` where `id` = ? limit 1', [lib.admins[host].id], () => {
|
||||||
e.reply('deleted user '+data.nick+' ('+host+')');
|
lib.loadUser();
|
||||||
});
|
e.reply('deleted user '+data.nick+' ('+host+')');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lib.sql.query('update `f0ck`.`user` set `level` = ? where `id` = ?', [level, lib.admins[host].id], () => {
|
||||||
|
lib.loadUser();
|
||||||
|
e.reply('changed user '+data.nick+' ('+host+') to level '+level);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lib.sql.query('update `f0ck`.`user` set `level` = ? where `id` = ?', [level, lib.admins[host].id], () => {
|
lib.sql.query('insert into `f0ck`.`user` (`nick`,`vhost`,`level`,`server`) values (?,?,?,?)', [data.nick, host, level, e.network], () => {
|
||||||
lib.loadUser();
|
lib.loadUser();
|
||||||
e.reply('changed user '+data.nick+' ('+host+') to level '+level);
|
e.reply('added new user '+data.nick+' ('+host+') with level '+level);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
lib.sql.query('insert into `f0ck`.`user` (`nick`,`vhost`,`level`,`server`) values (?,?,?,?)', [data.nick, host, level, e.network], () => {
|
e.reply('user '+data.nick+' isn\'t registered');
|
||||||
lib.loadUser();
|
|
||||||
e.reply('added new user '+data.nick+' ('+host+') with level '+level);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user