a basic swear filter and log the error

This commit is contained in:
Supositware 2019-02-24 23:41:37 +01:00
parent 69f9ec5a97
commit efe5e98ffa

View file

@ -28,8 +28,15 @@ class tweetCommand extends Command {
if (!text) if (!text)
return; return;
//Basic filter, hopefully i wont get banned from twitter
text = text.replace(/n[\w\W]+gg[\w\W]+|f[aA\W*-_0-9]gg[\w\W]+|f[aA\W*-_0-9]g|kys/gi, '❤');
console.log(text);
text = rand.random(text, message); text = rand.random(text, message);
let client = new Twitter({ let client = new Twitter({
consumer_key: twiConsumer, consumer_key: twiConsumer,
consumer_secret: twiConsumerSecret, consumer_secret: twiConsumerSecret,
@ -47,6 +54,7 @@ class tweetCommand extends Command {
// Send the final text // Send the final text
return message.channel.send(`Go see ur epic tweet https://twitter.com/HahaYesDB/status/${tweetid}`); return message.channel.send(`Go see ur epic tweet https://twitter.com/HahaYesDB/status/${tweetid}`);
} catch(err) { } catch(err) {
console.error(err);
return message.channel.send('Oh no, an error has occured :('); return message.channel.send('Oh no, an error has occured :(');
} }