Use this Discord command '$smile <@user>' to send a smile GIF to someone.
// authenticates you with the API standard library
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const gifs = [
'https://media1.tenor.com/images/606f4dad46758987e470e18563388e0c/tenor.gif?itemid=18458669',
'https://media1.tenor.com/images/64e0528a06b474ffb14525c437da2544/tenor.gif?itemid=11031890',
'https://media1.tenor.com/images/c8d13a4636c548e962d8d4fdb0eaa169/tenor.gif?itemid=12217236',
'https://media1.tenor.com/images/c5fad21f9828d19044a58f8b84a6e14b/tenor.gif?itemid=6013419',
'https://media1.tenor.com/images/f7dd3b25000f4ecb76ccd49d85189a58/tenor.gif?itemid=19326581',
];
const randomGif = gifs[Math.floor(Math.random() * gifs.length)];
if (
context.params.event.content.startsWith('$smile') &&
context.params.event.mentions.length === 1
) {
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
embed: {
type: 'rich',
title: `${context.params.event.author.username} smiles ${context.params.event.mentions[0].username}`,
description: '',
color: 0x00ffff,
image: {
url: randomGif,
},
},
});
}
if (
context.params.event.content.startsWith('$smile') &&
context.params.event.mentions.length !== 1
) {
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `You need to mention **one** person`,
});
}