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 ) {
|
||||
bot.whois(name.trim(), e.network, (err, data) => {
|
||||
var host = data.username+'@'+data.hostname;
|
||||
if(host in lib.admins) {
|
||||
if(level <= 0) {
|
||||
lib.sql.query('delete from `f0ck`.`user` where `id` = ? limit 1', [lib.admins[host].id], () => {
|
||||
lib.loadUser();
|
||||
e.reply('deleted user '+data.nick+' ('+host+')');
|
||||
});
|
||||
if(data.account !== null) {
|
||||
var host = data.username+'@'+data.hostname;
|
||||
if(host in lib.admins) {
|
||||
if(level <= 0) {
|
||||
lib.sql.query('delete from `f0ck`.`user` where `id` = ? limit 1', [lib.admins[host].id], () => {
|
||||
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 {
|
||||
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();
|
||||
e.reply('changed user '+data.nick+' ('+host+') to level '+level);
|
||||
e.reply('added new user '+data.nick+' ('+host+') with level '+level);
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
lib.sql.query('insert into `f0ck`.`user` (`nick`,`vhost`,`level`,`server`) values (?,?,?,?)', [data.nick, host, level, e.network], () => {
|
||||
lib.loadUser();
|
||||
e.reply('added new user '+data.nick+' ('+host+') with level '+level);
|
||||
});
|
||||
}
|
||||
else
|
||||
e.reply('user '+data.nick+' isn\'t registered');
|
||||
});
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user