From 408176cc9d704c513862ff8019c500263645f669 Mon Sep 17 00:00:00 2001 From: Supositware Date: Fri, 14 Apr 2023 04:24:46 +0200 Subject: [PATCH] Fix stupid censor --- commands/fun/tweet.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/commands/fun/tweet.js b/commands/fun/tweet.js index 88d47b03..b294d243 100644 --- a/commands/fun/tweet.js +++ b/commands/fun/tweet.js @@ -60,7 +60,17 @@ export default { } if (tweet) { + wordToCensor.forEach(async word => { + if (tweet.toLowerCase().includes(word.toLowerCase())) { + const body = { type:'tweet', uid: interaction.user.id, reason: 'Automatic ban from banned word.' }; + Blacklists.create(body); + + await interaction.editReply({ content: 'Sike, you just posted cringe! Enjoy the blacklist :)' }); + return; + } + }); // Detect banned word (Blacklist the user directly) + /* No worky (I don't remember what the fuck I wrote here) if (wordToCensor.includes(tweet) || wordToCensor.includes(tweet.substring(0, tweet.length - 1)) || wordToCensor.includes(tweet.substring(1, tweet.length))) { const body = { type:'tweet', uid: interaction.user.id, reason: 'Automatic ban from banned word.' }; Blacklists.create(body); @@ -68,6 +78,7 @@ export default { await interaction.editReply({ content: 'Sike, you just posted cringe! Enjoy the blacklist :)' }); return; } + */ // Very simple link detection if (new RegExp('([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?(/.*)?').test(tweet) && !tweet.includes('twitter.com')) { @@ -81,6 +92,7 @@ export default { } } + const T = new Twit({ consumer_key: twiConsumer, consumer_secret: twiConsumerSecret,