-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
const axios = require('axios'); // axios package to make a GET request to the Tenor API and retrieve a gif | ||
const { SlashCommandBuilder } = require('discord.js'); | ||
const { MessageEmbed } = require('discord.js'); | ||
const { tenorAPI } = require('./config.json'); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName('hug') | ||
.setDescription('Give someone a hug :)') | ||
.addIntegerOption(option => option.setName('hugee').setDescription('Person to hug')), | ||
.addUserOption(option => option.setName('hugee').setDescription('Person to hug').setRequired(true)), | ||
|
||
async execute(interaction) { | ||
// Your code goes here | ||
const query = 'anime-hug'; | ||
const limit = 1; | ||
const mediaFilter = 'minimal'; | ||
const user = interaction.options.getUser('hugee'); | ||
|
||
const { data } = await axios.get(`https://api.tenor.com/v1/search?q=${query}&key=${tenorAPI}&limit=${limit}&media_filter=${mediaFilter}`); | ||
|
||
const hugEmbed = new MessageEmbed() | ||
.setDescription(`Sending a hug to ${hugee} ❤️`) | ||
.setImage(data.results[0].media[0].gif.url); | ||
|
||
await interaction.reply({ embeds: [hugEmbed] }); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters