Skip to content

Commit

Permalink
✨ tweak: update feedback logic
Browse files Browse the repository at this point in the history
  • Loading branch information
warengonzaga authored May 8, 2024
1 parent 0cad1ad commit 501e50d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ client.on("interactionCreate", async (interaction) => {
// check if the interaction is a button click
if (interaction.isButton()) {


if (interaction.customId === "helpful") {
await interaction.reply({
embeds: [sendEmbedMessage(`Thank you so much for your feedback!`)],
Expand All @@ -158,17 +157,16 @@ client.on("interactionCreate", async (interaction) => {
queryId: result,
helpful: true,
});
console.log(`[${serverTime()}][log]: User sent a "Helpful" feedback!`);
}
});
await interaction.message.edit({ components: [] });
await redis.del(messageId);




} else if (interaction.customId === "not-helpful") {

// log the feedback
console.log(`[${serverTime()}][log]: User sent a "Helpful" feedback!`);
}

if (interaction.customId === "not-helpful") {
await interaction.reply({
embeds: [sendEmbedMessage(`Thank you for your valuable feedback, this will help us improve the responses of our AI assistant.\n\nIn the meantime, would you like to contact a human customer success agent? Just click the link or the button below to submit a ticket.`)],
content: `🔔 <@${interaction.user.id}>`,
Expand All @@ -183,13 +181,13 @@ client.on("interactionCreate", async (interaction) => {
queryId: result,
helpful: false,
});
console.log(`[${serverTime()}][log]: User sent a "Not Helpful" feedback!`);
}
});
await interaction.message.edit({ components: [] });
await redis.del(messageId);


// log the feedback
console.log(`[${serverTime()}][log]: User sent a "Not Helpful" feedback!`);
}
}
});
Expand Down

0 comments on commit 501e50d

Please sign in to comment.