Looks for positive and negative words and see's how happy someone is. If they're sad (beyond a certain extent), it gives a response. If they're happy (beyond a certain extent), it also gives a response.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const emotional = require("emotional");
await new Promise((resolve, reject) => {
emotional.load(resolve);
});
let polarity = emotional.get(context.params.event.content).polarity
if (polarity < -0.6) {
await lib.discord.channels['@0.1.0'].messages.create({
channel_id: context.params.event.channel_id,
content: `Oh no, you don't sound so happy. I hope your day gets better.`
});
} else {
if (polarity > 0.6) {
await lib.discord.channels['@0.1.0'].messages.create({
channel_id: context.params.event.channel_id,
content: `I'm happy that you're happy!`
});
}
}