From b74bac9ee7719d55b7ae189f2f0f588af46e4caf Mon Sep 17 00:00:00 2001 From: ZyLacx Date: Sat, 12 Feb 2022 15:05:59 +0100 Subject: [PATCH] Hotfix 2.2 Hug and headpat should be working now --- commands/headpat.js | 11 ++--------- commands/hug.js | 11 ++--------- helpFunctions.js | 8 ++++++-- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/commands/headpat.js b/commands/headpat.js index 4fa1fa6..e791d7a 100644 --- a/commands/headpat.js +++ b/commands/headpat.js @@ -11,15 +11,8 @@ module.exports = { options.setName('who') .setDescription('Is for me? c:')), async execute(interaction) { - const resultTuple = await headpat(interaction); - const embed = resultTuple[1]; - if (resultTuple[0] == null) { - interaction.reply({ embeds: [embed] }); - } - else { - const msgContent = resultTuple[0]; - interaction.reply({ content: msgContent, embeds: [embed] }); - } + const embed = await headpat(interaction); + interaction.reply({ embeds: [embed] }); }, }; diff --git a/commands/hug.js b/commands/hug.js index bd74fb1..8674972 100644 --- a/commands/hug.js +++ b/commands/hug.js @@ -11,15 +11,8 @@ module.exports = { options.setName('who') .setDescription('It\'s not me.. is it? :c')), async execute(interaction) { - const resultTuple = await hug(interaction); - const embed = resultTuple[1]; - if (resultTuple[0] == null) { - interaction.reply({ embeds: [embed] }); - } - else { - const msgContent = resultTuple[0]; - interaction.reply({ content: msgContent, embeds: [embed] }); - } + const embed = await hug(interaction); + interaction.reply({ embeds: [embed] }); }, }; diff --git a/helpFunctions.js b/helpFunctions.js index b99a821..030c92c 100644 --- a/helpFunctions.js +++ b/helpFunctions.js @@ -46,12 +46,16 @@ async function getGifEmbed(gifQuery, gifAmount) { async function getGifWithMessage(interaction, gifQuery, gifAmount) { const gifEmbed = getGifEmbed(gifQuery, gifAmount); + let who; try { - return (interaction.user.username + ' headpats ' + interaction.options.getMentionable('who'), gifEmbed); + who = interaction.options.getMentionable('who'); } catch { - return (null, gifEmbed); + return gifEmbed; } + (await gifEmbed).setDescription(interaction.user.username + + ` ${interaction.commandName}s ` + `${who}`); + return gifEmbed; } async function returnPromiseString(guildMembers) {