Ever wanted to whisper to a user in your server? This command does exactly the same. You can now whisper to any user in the server privately. No setup required, just create a Slash Command with a required user and message option for the user in your server and the message you wanna whisper!
//Built by ニキータ#2402
//Authenticates you w/ the API standard library
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
//In the lines 7 & 8, we're getting the data from discord such as user you mention and the message you type
let event = context.params.event;
let user = event.data.options[0].value; //User to Whisper
let message = context.params.event.data.options[1].value;
//The following message will only be shown to user using the command
await lib.discord.interactions['@1.0.1'].responses.ephemeral.create({
token: `${event.token}`,
embeds: [
{
title: ``,
description: `You whispered to <@${user}>`,
color: 0x0ef0e4,
},
],
response_type: 'CHANNEL_MESSAGE_WITH_SOURCE',
});
// The following message will be sent privately to the mentioned user
return await lib.discord.users['@0.2.1'].dms.create({
recipient_id: `${user}`,
content: ` `,
embed: {
title: `${event.member.user.username} whispered to you: \`\`\`\n${message}\`\`\``,
desription: ``,
color: 0x0ef0e4,
},
});