-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98f2420
commit 24f2a44
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
name: 'removed', | ||
description: 'Check how many bad letters were removed', | ||
async execute(client, message) { | ||
const userId = /\d+/u.exec(message.content)?.toString(); | ||
const member = userId ? await message.guild.members.fetch(userId).catch(() => null) ?? message.member : message.member; | ||
|
||
if (member.user.bot) { | ||
return message.channel.send({ | ||
embeds: [{ | ||
title: 'Invalid User', | ||
description: 'You need to mention a valid user!', | ||
color: client.config.color | ||
}] | ||
}); | ||
} | ||
|
||
const { count } = client.db.prepare('SELECT count FROM global_data').get(); | ||
const userCount = client.db.prepare('SELECT count FROM users WHERE id = ?').get(member.id)?.count ?? 0; | ||
const guildCount = client.db.prepare('SELECT count FROM guilds WHERE id = ?').get(message.guildId)?.count ?? 0; | ||
|
||
message.channel.send({ | ||
embeds: [{ | ||
title: 'Bad Letters Removed', | ||
color: client.config.color, | ||
description: `Removed ${count} bad letters in total`, | ||
fields: [ | ||
{ name: 'Server', value: `Removed ${guildCount} bad letters in this server` }, | ||
{ name: 'User', value: `Removed ${userCount} bad letters from ${member}` } | ||
] | ||
}] | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module.exports = { | ||
name: 'removed', | ||
contextMenu: 'Removed Count', | ||
async execute(client, interaction) { | ||
const member = interaction.options.getMember('user') ?? interaction.member; | ||
const user = interaction.options.getUser('user'); | ||
|
||
if (!member && user || member.user.bot) { | ||
return interaction.reply({ | ||
embeds: [{ | ||
title: 'Invalid User', | ||
description: 'You need to mention a valid user!', | ||
color: client.config.color | ||
}], | ||
ephemeral: true | ||
}); | ||
} | ||
|
||
const { count } = client.db.prepare('SELECT count FROM global_data').get(); | ||
const userCount = client.db.prepare('SELECT count FROM users WHERE id = ?').get(member.id)?.count ?? 0; | ||
const guildCount = client.db.prepare('SELECT count FROM guilds WHERE id = ?').get(interaction.guildId)?.count ?? 0; | ||
|
||
interaction.reply({ | ||
embeds: [{ | ||
title: 'Bad Letters Removed', | ||
color: client.config.color, | ||
description: `Removed ${count} bad letters in total`, | ||
fields: [ | ||
{ name: 'Server', value: `Removed ${guildCount} bad letters in this server` }, | ||
{ name: 'User', value: `Removed ${userCount} bad letters from ${member}` } | ||
] | ||
}] | ||
}); | ||
} | ||
}; |