Send Jacob's Face but mentioning a member is optional! This snippet will give you a good understanding on how to create an optional slash command response with jacob's face! Click run once so that slash command can be created in your server:)
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// Set the URL of Jacob's face.
let jacobImage = 'https://i.imgur.com/QJgkfKC.jpg';
//creates the slash command the first time you run the code:)
await lib.discord.commands['@0.0.0'].create({
"guild_id": `${context.params.event.guild_id}`,
"name": "jacob",
"description": "send jacob's face:)",
"options": [
{
"type": 6,
"name": "user",
"description": "a user to mention"
}
]
});
//if a user is mentioned in the option
if (context.params.event.data.options[0]) {
//send a mention of the user:)
await lib.discord.channels['@0.2.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `<@${context.params.event.data.options[0].value}>, <@${context.params.event.member.user.id}> asked me to send you Jacob's face lmao!`,
embeds: [
{
type: 'rich',
title: '',
description: '',
color: 0x00ffff,
image: {
url: `${jacobImage}`,
height: 0,
width: 0,
},
},
],
});
}
//otherwise if a user is NOT mentioned in the option
else if (!context.params.event.data.options[0]) {
//send this instead:)
await lib.discord.channels['@0.2.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `<@${context.params.event.member.user.id}> Jacob's face for you lmao!`,
embeds: [
{
type: 'rich',
title: '',
description: '',
color: 0x00ffff,
image: {
url: `${jacobImage}`,
height: 0,
width: 0,
},
},
],
});
}