Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- module.exports = {
- name: "invites",
- category: "info",
- description: "Look at how many invites a member has",
- run: async (bot, message, args, tools) => {
- let member = await message.mentions.members.first() || message.member;
- let invites = await message.guild.fetchInvites()
- let memberInvites = invites.filter(i => i.inviter && i.inviter.id === member.user.id);
- if (memberInvites.size <= 0) {
- return message.channel.send(`**${member.displayName} didn't invite anyone to the server!**`, (member === message.member ? null : member)); //--- "Didn't invite anyone to the server" is only when you want to see how many invites a member has. If they didn't invite anyone, it'll show that message.
- { }
- }
- let content = memberInvites.map(i => i.code).join("\n");
- let index = 0;
- memberInvites.forEach(invite => index += invite.uses);
- const embed = new Discord.MessageEmbed()
- .setColor("RANDOM") //--- Randomize colors whenever you type in the command. Can be set to a specific colour by going on Google and looking up a color hex code then replace RANDOM with that code.
- .setFooter(message.guild.name, message.guild.iconURL({ dynamic: true }))
- .setAuthor(`Invite Tracker for ${message.guild.name}`)
- .setDescription(`Information on Invites of ${member.displayName}`)
- .addField("**Invited Members**", index) //--- Title. Example: Invited People: 1. Invited Users: 10. Etc+
- .addField("Invitation Codes\n\n", content) //--- Title of the invites someone has. Example: Invitation Codes: thehub.
- .setThumbnail(message.guild.iconURL({ dynamic: true }))
- message.channel.send(embed);
- }, catch (e) {
- return message.channel.send(`\`${e.message}\``)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement