Sends an ephemeral message as a response to a slash command. This message will only be shown to the user who used the command.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
await lib.http.request['@1.1.6'].post({
url: `https://discord.com/api/webhooks/${context.params.event.application_id}/${context.params.event.token}`,
params: {
content: `Hello <@${context.params.event.member.user.id}> 👋`,
flags: 64,
embeds: [
{
type: 'rich',
title: `This is an ephemeral message`,
description: 'You can put embeds in here...',
color: 0x00ffff,
},
],
components: [
{
type: 1,
components: [
{
style: 1,
label: `And`,
custom_id: `ephemeral_1`,
disabled: false,
type: 2,
},
{
style: 2,
label: `Buttons`,
custom_id: `ephemeral_2`,
disabled: false,
type: 2,
},
{
style: 3,
label: `Too`,
custom_id: `ephemeral_3`,
disabled: false,
type: 2,
},
],
},
],
},
});