There are 2 ways to use this command: guess higher and guess lower , ex: guess lower 999 - basically generates random number then checks if your number is higher/lower then random number!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let message = context.params.event.content;
let your = context.params.event.content.split(' ').slice(2).join('_');
let number = Math.floor(Math.random() * 1001);
let command;
if (`${your}` < `${number}`) {
command = `Yep, **${your}** is lower then **${number}**`;
} else {
command = `No, **${your}** is not lower then **${number}**`;
}
if(message.startsWith(`guess lower`)) {
await lib.discord.channels['@0.0.6'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `${command}`
});
}
if (`${your}` > `${number}`) {
command = `Yep, **${your}** is higher then **${number}**`;
} else {
command = `No, **${your}** is not higher then **${number}**`;
}
if(message.startsWith(`guess higher`)) {
await lib.discord.channels['@0.0.6'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `${command}`
});
}