Whenever someone says something containing something similar to "I'm", the bot will return a sentence with the following format: "Hello <string after I'm>, I'm dad". If the person tries to trick the bot by using their own username, the bot will not respond.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let content = context.params.event.content;
if (context.params.event.content.match(/\bI'm\b|\bim\b|\bI am\b/i)) {
let match = context.params.event.content.match(/\bI'm\b|\bim\b|\bI am\b/i);
for (let i = 0; i <= content.indexOf(match) + 1; i++) {
content = content.split(' ').slice(1).join(' ');
}
if (
content.toLowerCase() !== context.params.event.author.username.toLowerCase()
) {
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `Hello ${content}, I'm dad`,
});
}
}