Restructure savegif & implement ephemeral response
This commit is contained in:
parent
2b7253ffae
commit
457c52ba0c
18
main.js
18
main.js
@ -107,18 +107,12 @@ client.on('interactionCreate', async interaction => {
|
||||
interaction.update(strings.temp.gifs[newIndex].embed_url);
|
||||
break;
|
||||
case 'confirmGif':
|
||||
interaction.update({ content: 'GIF Confirmed, what should I save it as?\n(*don\'t* include the .gif)', components: [] });
|
||||
const collector = fn.collect.gifName(interaction);
|
||||
collector.on('collect', m => {
|
||||
const gifData = {
|
||||
name: m.content.toLowerCase(),
|
||||
embed_url: strings.temp.gifs[strings.temp.gifIndex].embed_url,
|
||||
};
|
||||
fn.upload.gif(gifData, client);
|
||||
m.reply(`I've saved the GIF as ${gifData.name}.gif`);
|
||||
fn.download.gifs(interaction.client);
|
||||
collector.stop('success');
|
||||
});
|
||||
const gifData = {
|
||||
name: strings.temp.gifName,
|
||||
embed_url: strings.temp.gifs[strings.temp.gifIndex].embed_url,
|
||||
};
|
||||
fn.upload.gif(gifData, client);
|
||||
interaction.update({ content: `I've saved the GIF as ${gifData.name}.gif`, components: [] });
|
||||
fn.download.gifs(interaction.client);
|
||||
break;
|
||||
case 'nextGif':
|
||||
|
@ -18,6 +18,10 @@ module.exports = {
|
||||
.addStringOption(option =>
|
||||
option.setName('query')
|
||||
.setDescription('Search Query')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option.setName('name')
|
||||
.setDescription('What to save the gif as')
|
||||
.setRequired(true)),
|
||||
async execute(interaction) {
|
||||
// Previous GIF button
|
||||
@ -33,6 +37,7 @@ module.exports = {
|
||||
|
||||
// Get the query
|
||||
const query = interaction.options.getString('query');
|
||||
strings.temp.gifName = interaction.options.getString('name').toLowerCase();
|
||||
|
||||
// Search Tenor for the GIF
|
||||
tenor.Search.Query(query, '10').then(res => {
|
||||
|
Loading…
Reference in New Issue
Block a user