Skip to content

Commit

Permalink
v2.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
TheShadowGamer committed Apr 7, 2021
1 parent 6ad2449 commit bf48c99
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion commands/info/inviteinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = class InviteInfoCommand extends Command {
}
],
userPermissions(message) {
if(!message.member.roles.cache.some(role => role.name === 'Manage Invites')) return 'Manage Invites';
if(!message.member.roles.cache.some(role => role.name === 'Manage Invites') && !message.member.permissions.has(['BAN_MEMBERS', 'KICK_MEMBERS', 'MANAGE_GUILD', 'MANAGE_CHANNELS'])) return 'Manage Invites';
return null;
}
});
Expand Down
2 changes: 1 addition & 1 deletion commands/info/userinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = class UserInfoCommand extends Command {
}
],
userPermissions(message) {
if(!message.member.roles.cache.some(role => role.name === 'Manage Invites')) return 'Manage Invites';
if(!message.member.roles.cache.some(role => role.name === 'Manage Invites') && !message.member.permissions.has(['BAN_MEMBERS', 'KICK_MEMBERS', 'MANAGE_GUILD', 'MANAGE_CHANNELS'])) return 'Manage Invites';
return null;
}
});
Expand Down
2 changes: 1 addition & 1 deletion commands/invites/addinvites.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = class AddInvitesCommand extends Command {
}
],
userPermissions(message) {
if(!message.member.roles.cache.some(role => role.name === 'Manage Invites') || message.member.permissions.has(['BAN_MEMBERS', 'KICK_MEMBERS', 'MANAGE_GUILD', 'MANAGE_CHANNELS'])) return 'Manage Invites';
if(!message.member.roles.cache.some(role => role.name === 'Manage Invites') && !message.member.permissions.has(['BAN_MEMBERS', 'KICK_MEMBERS', 'MANAGE_GUILD', 'MANAGE_CHANNELS'])) return 'Manage Invites';
return null;
}
});
Expand Down
10 changes: 8 additions & 2 deletions commands/invites/leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ module.exports = class LeaderboardCommand extends Command {
.setColor(client.config.colors.main);
const all = await invites.findAll({order: [['invites', 'DESC']], limit: 10, where: {guildID: message.guild.id}});
let LB = [];
let i = 0
await all.forEach(async entry => {
if(!entry.invites) return;
LB.push(`${LB.length + 1}. ${(await (client.users.fetch(entry.discordUser))).tag} - ${entry.invites}`);
let user = await client.users.fetch(entry.discordUser)
i++
LB.push(`${i}. **${user.username}**#${user.discriminator} - ${entry.invites}`);
});
if(LB.length === 0) {embed.setDescription('No one in this server has any invites!')} else {embed.setDescription(`Here are the top ${LB.length} inviters!\n${LB.join('\n')}`)}
message.channel.send(embed);
Expand All @@ -39,9 +42,12 @@ module.exports.slashCommand = async (client, interaction, args, respond) => {
.setColor(client.config.colors.main);
const all = await invites.findAll({order: [['invites', 'DESC']], limit: 10, where: {guildID: interaction.guild.id}});
let LB = [];
let i = 0
await all.forEach(async entry => {
if(!entry.invites) return;
LB.push(`${LB.length + 1}. ${(await (client.users.fetch(entry.discordUser))).tag} - ${entry.invites}`);
let user = await client.users.fetch(entry.discordUser)
i++
LB.push(`${i}. **${user.username}**#${user.discriminator} - ${entry.invites}`);
});
if(LB.length === 0) {embed.setDescription('No one in this server has any invites!')} else {embed.setDescription(`Here are the top ${LB.length} inviters!\n${LB.join('\n')}`)}
respond({embeds: [embed]});
Expand Down
2 changes: 1 addition & 1 deletion commands/invites/removeinvites.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = class RemoveInvitesCommand extends Command {
}
],
userPermissions(message) {
if(!message.member.roles.cache.some(role => role.name === 'Manage Invites') || message.member.permissions.has(['BAN_MEMBERS', 'KICK_MEMBERS', 'MANAGE_GUILD', 'MANAGE_CHANNELS'])) return 'Manage Invites';
if(!message.member.roles.cache.some(role => role.name === 'Manage Invites') && !message.member.permissions.has(['BAN_MEMBERS', 'KICK_MEMBERS', 'MANAGE_GUILD', 'MANAGE_CHANNELS'])) return 'Manage Invites';
return null;
}
});
Expand Down
2 changes: 1 addition & 1 deletion commands/invites/resetinvites.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = class ResetInvitesCommand extends Command {
}
],
userPermissions(message) {
if(!message.member.roles.cache.some(role => role.name === 'Manage Invites') || message.member.permissions.has(['BAN_MEMBERS', 'KICK_MEMBERS', 'MANAGE_GUILD', 'MANAGE_CHANNELS'])) return 'Manage Invites';
if(!message.member.roles.cache.some(role => role.name === 'Manage Invites') && !message.member.permissions.has(['BAN_MEMBERS', 'KICK_MEMBERS', 'MANAGE_GUILD', 'MANAGE_CHANNELS'])) return 'Manage Invites';
return null;
}
});
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "invite-manager",
"version": "2.0.4",
"version": "2.0.5",
"description": "Invite manager is an open source bot that allows you to track people's invites. You can join the support server here if you need help with anything: https://discord.gg/xNks8jb",
"main": "index.js",
"dependencies": {
Expand Down

0 comments on commit bf48c99

Please sign in to comment.