This is a snippet where basically if a message contains something like lol, then it'll randomly react with the joy emoticon on your message. No setup required!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const message = context.params.event.content;
const messageid = context.params.event.id;
const channel_id = context.params.event.channel_id;
let randomlist = [`Yes`, `No`];
let randomgenerator = Math.floor(Math.random() * randomlist.length);
let answer = randomlist[randomgenerator];
if (`${message}`.match(`lol`)) {
if (`${answer}`.match(`Yes`)) {
await lib.discord.channels['@0.3.2'].messages.reactions.create({
emoji: `π`,
message_id: `${messageid}`,
channel_id: `${channel_id}`,
});
}
}
if (`${message}`.match(`LOL`)) {
if (`${answer}`.match(`Yes`)) {
await lib.discord.channels['@0.3.2'].messages.reactions.create({
emoji: `π`,
message_id: `${messageid}`,
channel_id: `${channel_id}`,
});
}
}
if (`${message}`.match(`lmao`)) {
if (`${answer}`.match(`Yes`)) {
await lib.discord.channels['@0.3.2'].messages.reactions.create({
emoji: `π`,
message_id: `${messageid}`,
channel_id: `${channel_id}`,
});
}
}
if (`${message}`.match(`LMAO`)) {
if (`${answer}`.match(`Yes`)) {
await lib.discord.channels['@0.3.2'].messages.reactions.create({
emoji: `π`,
message_id: `${messageid}`,
channel_id: `${channel_id}`,
});
}
}
if (`${message}`.match(`lmfao`)) {
if (`${answer}`.match(`Yes`)) {
await lib.discord.channels['@0.3.2'].messages.reactions.create({
emoji: `π`,
message_id: `${messageid}`,
channel_id: `${channel_id}`,
});
}
}
if (`${message}`.match(`LMFAO`)) {
if (`${answer}`.match(`Yes`)) {
await lib.discord.channels['@0.3.2'].messages.reactions.create({
emoji: `π`,
message_id: `${messageid}`,
channel_id: `${channel_id}`,
});
}
}