@ -7,7 +7,6 @@ module.exports = {
aliases : [ 'bl' ] ,
aliases : [ 'bl' ] ,
help : "Disables a user from using Natsuki ( Usage: {{p}}blacklist <user_id> <add || del> )" ,
help : "Disables a user from using Natsuki ( Usage: {{p}}blacklist <user_id> <add || del> )" ,
async execute ( message , msg , args , cmd , prefix , mention , client ) {
async execute ( message , msg , args , cmd , prefix , mention , client ) {
let tu = await UserData . findOne ( { uid : message . author . id } ) ;
let tu = await UserData . findOne ( { uid : message . author . id } ) ;
if ( [ 'g' , 'guild' ] . includes ( args [ 0 ] . toLowerCase ( ) ) ) {
if ( [ 'g' , 'guild' ] . includes ( args [ 0 ] . toLowerCase ( ) ) ) {
@ -21,30 +20,28 @@ module.exports = {
if ( args [ 1 ] . match ( /\d+/ ) ) { args . shift ( ) ; }
if ( args [ 1 ] . match ( /\d+/ ) ) { args . shift ( ) ; }
if ( ! args [ 1 ] ) { return message . channel . send ( "You must specify whether to `add` or `del` a guild's blacklist!" ) ; }
if ( ! args [ 1 ] ) { return message . channel . send ( "You must specify whether to `add` or `del` a guild's blacklist!" ) ; }
let tu = await UserData . findOne ( { uid : message . author . id } ) ;
if ( ! tu || ! tu . admin ) { return message . reply ( "You must be a Natsuki Admin to blacklist!" ) ; }
if ( message . guild . id === "762707532417335296" ) { return message . reply ( "You can't blacklist my support server!" ) ; }
if ( message . guild . id === "762707532417335296" ) { return message . reply ( "You can't blacklist my support server!" ) ; }
if ( [ 'a' , 'add' ] . includes ( args [ 1 ] . toLowerCase ( ) ) ) {
if ( [ 'a' , 'add' ] . includes ( args [ 1 ] . toLowerCase ( ) ) ) {
if ( tg . blacklisted ) { return message . reply ( "That guild is already blacklisted!" ) ; }
if ( tg . blacklisted ) { return message . reply ( "That guild is already blacklisted!" ) ; }
tg . blacklisted = true ;
tg . blacklisted = true ;
tg . save ( ) ;
tg . save ( ) ;
client . misc . cache . bl . guild . push ( message . guild . id ) ;
return message . channel . send ( "Gotcha! This server will not be able to use my commands!" ) ;
return message . channel . send ( "Gotcha! This server will not be able to use my commands!" ) ;
}
}
if ( [ 'r' , 'rem' , 'remove' , 'd' , 'del' , 'delete' ] . includes ( args [ 1 ] . toLowerCase ( ) ) ) {
if ( [ 'r' , 'rem' , 'remove' , 'd' , 'del' , 'delete' ] . includes ( args [ 1 ] . toLowerCase ( ) ) ) {
if ( tg . blacklisted ) { return message . reply ( "That guild isn't blacklisted in the first place!" ) ; }
if ( ! tg . blacklisted ) { return message . reply ( "That guild isn't blacklisted in the first place!" ) ; }
tg . blacklisted = false ;
tg . blacklisted = false ;
tg . save ( ) ;
tg . save ( ) ;
delete client . misc . cache . bl . guild [ client . misc . cache . bl . guild . indexOf ( message . guild . id ) ] ;
return message . channel . send ( "I have graced your merciful request; this server can once again make use of my wonderous abilities!" ) ;
return message . channel . send ( "I have graced your merciful request; this server can once again make use of my wonderous abilities!" ) ;
}
}
return message . channel . send ( "Valid args: `[guildID] <add|del>`" ) ;
return message . channel . send ( "Valid args: `[guildID] <add|del>`" ) ;
}
}
if ( [ 'u' , 'user' ] . includes ( args [ 0 ] . toLowerCase ( ) ) ) {
if ( [ 'u' , 'user' ] . includes ( args [ 0 ] . toLowerCase ( ) ) ) {
args . shift ( ) ;
args . shift ( ) ;
if ( ! args [ 1 ] ) { return message . channel . send ( "You must specify whether to `add` or `del` a user's blacklist!" ) ; }
if ( ! args [ 1 ] ) { return message . channel . send ( "You must specify whether to `add` or `del` a user's blacklist!" ) ; }
@ -65,6 +62,8 @@ module.exports = {
if ( usersData . blacklisted === true ) { return message . reply ( 'they\'re already blacklisted :eyes:' ) ; }
if ( usersData . blacklisted === true ) { return message . reply ( 'they\'re already blacklisted :eyes:' ) ; }
await UserData . findOneAndUpdate ( { uid : blacklistUser } , { blacklisted : true } . catch ( ( ) => { } ) ) ;
await UserData . findOneAndUpdate ( { uid : blacklistUser } , { blacklisted : true } . catch ( ( ) => { } ) ) ;
client . misc . cache . bl . user . push ( blacklistUser ) ;
return message . channel . send ( ` Another one bites the dust! ** ${ blacklistUser . user . tag } ** has been blacklisted! ` )
return message . channel . send ( ` Another one bites the dust! ** ${ blacklistUser . user . tag } ** has been blacklisted! ` )
}
}
@ -78,11 +77,11 @@ module.exports = {
if ( userData . blacklisted === false ) { return message . reply ( 'hate to break it you... they\'re not even blacklisted!' ) ; }
if ( userData . blacklisted === false ) { return message . reply ( 'hate to break it you... they\'re not even blacklisted!' ) ; }
await UserData . findOneAndUpdate ( { uid : blacklistedUser } , { blacklisted : false } . catch ( ( ) => { } ) ) ;
await UserData . findOneAndUpdate ( { uid : blacklistedUser } , { blacklisted : false } . catch ( ( ) => { } ) ) ;
delete client . misc . cache . bl . user [ client . misc . cache . bl . user . indexOf ( blacklistedUser ) ] ;
return message . channel . send ( ` Alright, there you go, I unblacklisted ** ${ blacklistedUser . user . tag } ** ` )
return message . channel . send ( ` Alright, there you go, I unblacklisted ** ${ blacklistedUser . user . tag } ** ` )
}
}
return message . channel . send ( "Valid args: `<userID|@user> <add|del>`" ) ;
return message . channel . send ( "Valid args: `<userID|@user> <add|del>`" ) ;
}
}
} } ;
} } ;