2021-02-28 00:39:52 -06:00
module . exports = {
2022-03-26 03:33:18 -05:00
name : 'setnick' ,
description : 'Sets your nickname' ,
2022-03-26 03:58:15 -05:00
async execute ( _ , message , args , footer ) {
2022-03-26 03:33:18 -05:00
2021-03-12 10:57:13 -06:00
if ( message . channel . permissionsFor ( message . author ) . has ( "CHANGE_NICKNAME" ) ) {
2022-03-26 03:33:18 -05:00
const newnick = args . slice ( 0 ) . join ( " " )
2021-03-16 17:18:18 -05:00
2022-03-26 03:33:18 -05:00
try {
await message . member . setNickname ( newnick , "Nickname change requested by the server member. If you don't want users to be able to change their nickname disable 'CHANGE_NICKNAME' via Change Nickname in Roles." )
2022-03-26 11:02:17 -05:00
await message . channel . send ( { embed : {
2022-03-26 03:33:18 -05:00
"title" : "<:AnitroxSuccess:809651936819019796> Nickname Changed" ,
"color" : 9442302 ,
2022-03-26 03:58:15 -05:00
"footer" : footer ,
2022-03-26 03:33:18 -05:00
"fields" : [
{
"name" : "Changed nickname successfully!" ,
"value" : "You need to have permission ``CHANGE_NICKNAME`` to change your nick!"
} ,
{
"name" : "New Nickname" ,
"value" : newnick ,
"inline" : true
}
]
2022-03-26 11:02:17 -05:00
} } ) ;
2022-03-26 03:33:18 -05:00
} catch ( error ) {
2022-03-26 11:02:17 -05:00
await message . channel . send ( { embed : {
2022-03-26 03:33:18 -05:00
"title" : "<:AnitroxDenied:809651936642203668> Well that happened..." ,
"color" : 13632027 ,
2022-03-26 03:58:15 -05:00
"footer" : footer ,
2022-03-26 03:33:18 -05:00
"fields" : [
{
"name" : "Failed to set nickname" ,
"value" : "You need to have permission ``CHANGE_NICKNAME`` to change your nick!"
}
]
2022-03-26 11:02:17 -05:00
} } ) ;
2022-03-26 03:33:18 -05:00
} ;
2021-03-12 10:57:13 -06:00
} ;
2022-03-26 03:33:18 -05:00
}
}