-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from Project-Coda/dev
Warn on mass mention
- Loading branch information
Showing
5 changed files
with
81 additions
and
5 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,31 @@ | ||
const embedcreator = require('../embed.js'); | ||
const env = require('../env.js'); | ||
async function checkMention(message) { | ||
try { | ||
if (message.member.roles.cache.has(env.discord.admin_role) || message.member.roles.cache.has(env.discord.mod_role)) return; | ||
if (message.content.includes('@everyone') || message.content.includes('@here')) { | ||
embed = embedcreator.setembed( | ||
{ | ||
title: 'Unauthorized Mention Detected', | ||
description: 'You have attempted to mention everyone or here that behavior is not allowed.', | ||
color: 0xe74c3c, | ||
}, | ||
), | ||
await embedcreator.mentionAlert(message); | ||
reply = await message.reply({ embeds: [embed], ephemeral: true }); | ||
message.delete(); | ||
// wait 5 seconds then delete the reply | ||
setTimeout(() => { | ||
reply.delete(); | ||
} | ||
, 5000); | ||
} | ||
} | ||
catch (err) { | ||
console.log(err); | ||
embedcreator.sendError(err); | ||
} | ||
} | ||
module.exports = { | ||
checkMention, | ||
}; |