The bot will ping anyone who is being rude. It makes a POST request to https://sentim-api.herokuapp.com/
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios');
const sentimentalChecker = await axios
.post('https://sentim-api.herokuapp.com/api/v1/', {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
text: context.params.event.content,
})
.then((res) => res.data);
if (!sentimentalChecker.result) return;
if (sentimentalChecker.result.type === 'negative')
return lib.discord.channels['@0.2.0'].messages.create({
content: `Hey, Please don't be rude to others.`,
channel_id: context.params.event.channel_id,
message_reference: {
message_id: context.params.event.id,
channel_id: context.params.event.channel_id,
},
});