Skip to content

Commit

Permalink
Fix global-blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMonDon committed Aug 3, 2024
1 parent 0c91068 commit 4862543
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
1 change: 0 additions & 1 deletion commands/Bot Support/global-blacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class GlobalBlacklist extends Command {

const blacklist = await db.get(`users.${mem.id}.blacklist`);

console.log(mem);
const embed = new EmbedBuilder()
.setAuthor({ name: mem.tag, iconURL: mem.displayAvatarURL() })
.setColor(msg.settings.embedColor)
Expand Down
2 changes: 1 addition & 1 deletion commands/Owner/export-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ExportCommands extends Command {
const embed = new EmbedBuilder()
.setTitle('Commands Exported')
.setDescription(`All commands have been exported to \`${jsonFilePath}\``)
.setColor('#00FF00');
.setColor(msg.settings.embedSuccessColor);

msg.channel.send({ embeds: [embed] });
}
Expand Down
6 changes: 3 additions & 3 deletions events/Interaction/interactionCreate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ const db = new QuickDB();

export async function run(client, interaction) {
interaction.settings = client.getSettings(interaction.guild);
const level = client.permlevel(interaction);

const globalBlacklisted = (await db.get(`users.${interaction.user.id}.blacklist`)) || false;
if (globalBlacklisted) {
if (globalBlacklisted && level < 8) {
const embed = new EmbedBuilder()
.setTitle('Blacklisted')
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL() })
Expand All @@ -18,7 +19,7 @@ export async function run(client, interaction) {
if (interaction.guild) {
const blacklisted =
(await db.get(`servers.${interaction.guild.id}.users.${interaction.user.id}.blacklist`)) || false;
if (blacklisted) {
if (blacklisted && level < 4) {
const embed = new EmbedBuilder()
.setTitle('Blacklisted')
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL() })
Expand All @@ -34,7 +35,6 @@ export async function run(client, interaction) {
const slashCommand = client.slashCommands.get(interaction.commandName);
if (!slashCommand) return;

const level = client.permlevel(interaction);
if (level < client.levelCache[slashCommand.conf.permLevel]) {
const embed = new EmbedBuilder()
.setTitle('Missing Permission')
Expand Down
10 changes: 8 additions & 2 deletions events/Message/messageCreate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,18 @@ export async function run(client, message) {
}

const globalBlacklisted = await db.get(`users.${message.author.id}.blacklist`);
if (globalBlacklisted) {
if (
globalBlacklisted &&
level < 8 &&
(command.help.name !== 'blacklist' || command.help.name !== 'global-blacklist')
) {
return message.channel.send(`Sorry ${message.author.username}, you are currently blacklisted from using commands.`);
}

if (!message.guild && command.conf.guildOnly) {
return message.channel.send('This command is unavailable via private message. Please run this command in a guild.');
return message.channel.send(
'This command is unavailable via private message. Please run this command in a server.',
);
}

if (command.conf.nsfw && !message.channel.nsfw) {
Expand Down
6 changes: 3 additions & 3 deletions events/Message/messageUpdate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,16 @@ export async function run(client, oldMessage, newMessage) {

// Check if the member is blacklisted from using commands in this guild.
if (newMessage.guild) {
const bl = await db.get(`servers.${newMessage.guild.id}.users.${newMessage.member.id}.blacklist`);
if (bl && level < 4 && cmd.help.name !== 'blacklist') {
const blacklist = await db.get(`servers.${newMessage.guild.id}.users.${newMessage.member.id}.blacklist`);
if (blacklist && level < 4 && (cmd.help.name !== 'blacklist' || cmd.help.name !== 'global-blacklist')) {
return newMessage.channel.send(
`Sorry ${newMessage.member.displayName}, you are currently blacklisted from using commands in this server.`,
);
}
}

const globalBlacklisted = await db.get(`users.${newMessage.author.id}.blacklist`);
if (globalBlacklisted) {
if (globalBlacklisted && level < 8 && (cmd.help.name !== 'blacklist' || cmd.help.name !== 'global-blacklist')) {
return newMessage.channel.send(
`Sorry ${newMessage.author.username}, you are currently blacklisted from using commands.`,
);
Expand Down

0 comments on commit 4862543

Please sign in to comment.