Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on("message", async message => {
- if (!message.channel.guild) return;
- if (message.content.startsWith(prefix + "invite-codes")) {
- let guild = message.guild;
- var codes = [""];
- message.channel.send(
- ":postbox: **لقد قمت بأرسال جميع روابط الدعوات التي قمت بأنشائها في الخاص**"
- );
- guild
- .fetchInvites()
- .then(invites => {
- invites.forEach(invite => {
- if (invite.inviter === message.author) {
- codes.push(`discord.gg/${invite.code}`);
- }
- });
- })
- .then(m => {
- if (codes.length < 0) {
- var embed = new Discord.RichEmbed()
- .setColor("#000000")
- .addField(
- `Your invite codes in ${message.guild.name}`,
- `You currently don't have any active invites! Please create an invite and start inviting, then you will be able to see your codes here!`
- );
- message.author.send({ embed: embed });
- return;
- } else {
- var embed = new Discord.RichEmbed()
- .setColor("#000000")
- .addField(
- `Your invite codes in ${message.guild.name}`,
- `Invite Codes:\n${codes.join("\n")}`
- );
- message.author.send({ embed: embed });
- return;
- }
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement