aboutsummaryrefslogtreecommitdiff
path: root/commands/Utility/nick.js
blob: bec95788245dcbf30b0cb6953642ed85ced3d7ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/** **************************************
 *
 *   Nick: Plugin for PokeBot that changes the user's display name.
 *   Copyright (C) 2018 TheEdge, jtsshieh, Alee
 *
 *   Licensed under the Open Software License version 3.0
 *
 * *************************************/

exports.run = async (bot, msg, args) => {
  const { RichEmbed } = require('discord.js');

  msg.member.setNickname(args.join(' '), 'Requested by bot');
  msg.channel.send('Changed nickname to: ' + args.join(' '));
  const logChannel = await bot.plugins.settings.getStr('logs', msg.member.guild.id);
  if (!logChannel) return;
  const channelObj = bot.channels.find('id', logChannel);
  if (!channelObj) return;
  channelObj.send(
    new RichEmbed()
      .setColor(0x00ae86)
      .setTitle(`Nickname: ${msg.author.tag}`)
      .setDescription(`*${msg.author.tag}* changed their nickname`)
      .addField('New Nickname', msg.member.displayName, true)
      .setTimestamp()
      .setFooter('PokeBot v1.0')
  );

};

exports.conf = {
  aliases: ['nickname'],
  guildOnly: true,
};

exports.help = {
  name: 'nick',
  description: 'Change your nickname.',
  usage: '<...new nick>',
};