2019-09-13 20:02:41 +00:00
const database = require ( "../utils/database.js" ) ;
exports . run = async ( message , args ) => {
2019-11-05 15:52:46 +00:00
const guild = ( await database . guilds . find ( { id : message . channel . guild . id } ) . exec ( ) ) [ 0 ] ;
2019-09-13 20:02:41 +00:00
if ( args . length !== 0 ) {
2019-11-15 16:59:50 +00:00
if ( ! message . member . permission . has ( "administrator" ) && message . member . id !== process . env . OWNER ) return ` ${ message . author . mention } , you need to be an administrator to change the bot prefix! ` ;
2019-10-28 20:21:06 +00:00
guild . set ( "prefix" , args [ 0 ] ) ;
await guild . save ( ) ;
2019-09-13 20:02:41 +00:00
return ` The prefix has been changed to ${ args [ 0 ] } . ` ;
} else {
2019-10-28 20:21:06 +00:00
return ` ${ message . author . mention } , the current prefix is \` ${ guild . prefix } \` . ` ;
2019-09-13 20:02:41 +00:00
}
} ;
exports . aliases = [ "setprefix" , "changeprefix" , "checkprefix" ] ;