Skip to content
This repository has been archived by the owner on Oct 6, 2019. It is now read-only.

Commit

Permalink
catch err
Browse files Browse the repository at this point in the history
  • Loading branch information
robflop committed May 28, 2017
1 parent 566e26a commit 87404e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/commands/setavatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ class SetAvatarCommand extends Command {
const validExts = ['png', 'jpg', 'gif', 'jpeg', 'webp'];
const ext = args.url.substr(args.url.lastIndexOf('.') + 1);
if (!validExts.includes(ext)) return message.reply('invalid file format! Only PNGs, JP(E)Gs, WebPs and GIFs are accepted.');
message.client.user.setAvatar(args.imageURL).then(user => {
message.reply(`successfully set my avatar to '<${args.imageURL}>'!`);
message.client.user.setAvatar(args.imageURL)
.then(user => {
message.reply(`successfully set my avatar to \`${args.imageURL}\`!`);
message.client.logger.info(`Avatar set to '${args.imageURL}'`);
});
})
.catch(err => message.reply(`an error occurred setting my avatar: \`${err.code}\`!`));
}
}

Expand Down

0 comments on commit 87404e9

Please sign in to comment.