aboutsummaryrefslogtreecommitdiff
path: root/handler/button.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-01-07 18:04:44 +0100
committerMinteck <contact@minteck.org>2022-01-07 18:04:44 +0100
commitac2dea4a23ca72001e41c1dbf66ff1a0d01e217c (patch)
tree3cb37a7135bf5530917270ebde08f797ff52ea38 /handler/button.js
parent041b8d1035cf0e7f6f8c686ec5dd7aa4ef204907 (diff)
downloadponyfind-ac2dea4a23ca72001e41c1dbf66ff1a0d01e217c.tar.gz
ponyfind-ac2dea4a23ca72001e41c1dbf66ff1a0d01e217c.tar.bz2
ponyfind-ac2dea4a23ca72001e41c1dbf66ff1a0d01e217c.zip
Update
Diffstat (limited to 'handler/button.js')
-rwxr-xr-xhandler/button.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/handler/button.js b/handler/button.js
new file mode 100755
index 0000000..5d5fe03
--- /dev/null
+++ b/handler/button.js
@@ -0,0 +1,60 @@
+const fs = require('fs');
+const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js');
+
+module.exports = async (interaction) => {
+ keys = interaction.customId.split("|")
+
+ if (keys[0] === "result.report") {
+ await interaction.reply({
+ ephemeral: false,
+ embeds: [
+ new MessageEmbed()
+ .setColor('#dc2828')
+ .setTitle(l("Report an issue with", "Signaler un problème avec", interaction.user.id, interaction.guild.id) + " \"" + keys[1] + "\"")
+ .setDescription(l("If you think the result to your query is problematic, you can report it so that the developers fix the issue.", "Si vous pensez que le résultat donné est problématique, vous pouvez le signaler pour que les développeurs corrigent le problème.", interaction.user.id, interaction.guild.id))
+ ],
+ components: [
+ new MessageActionRow()
+ .addComponents(
+ new MessageSelectMenu()
+ .setCustomId('select')
+ .setPlaceholder(l("Select a type of issue", "Sélectionnez le type de problème", interaction.user.id, interaction.guild.id))
+ .addOptions([
+ {
+ label: l("Inappropriate", "Inapproprié", interaction.user.id, interaction.guild.id),
+ description: l("The result contains inappropriate content: chocking or violent.", "La réponse contient du contenu inapproprié à certains publics, choquant, ou violent.", interaction.user.id, interaction.guild.id),
+ value: 'report.issue.innapropriate|' + keys[1],
+ },
+ {
+ label: l("Off topic", "Hors sujet", interaction.user.id, interaction.guild.id),
+ description: l("The result contains info that is unrelated to the aforementioned character.", "La réponse contient du contenu n'ayant pas de rapport avec le personnage évoqué.", interaction.user.id, interaction.guild.id),
+ value: 'report.issue.off|' + keys[1],
+ },
+ {
+ label: l("Incoherent data", "Données incohérentes", interaction.user.id, interaction.guild.id),
+ description: l("The result contains incoherent data, due to a database error.", "La réponse contient des données incohérentes, dûes à une erreur dans la base de données.", interaction.user.id, interaction.guild.id),
+ value: 'report.issue.data|' + keys[1],
+ },
+ {
+ label: l("Wrong result", "Mauvais résultat", interaction.user.id, interaction.guild.id),
+ description: l("The given result is not what was expected with this query.", "La réponse donnée n'est pas la réponse attendue par rapport à la demande.", interaction.user.id, interaction.guild.id),
+ value: 'report.issue.wrong|' + keys[1],
+ },
+ {
+ label: l("Wrong image(s)", "Mauvaise(s) image(s)", interaction.user.id, interaction.guild.id),
+ description: l("One or more of the provided image(s) do(es)n't correspond to the shown character.", "Une ou plusieurs image(s) fournie(s) avec la réponse ne correspond(ent) pas au personnage affiché.", interaction.user.id, interaction.guild.id),
+ value: 'report.issue.image|' + keys[1],
+ },
+ {
+ label: l("Wrong information", "Information erronée", interaction.user.id, interaction.guild.id),
+ description: l("A provided info does not correspond to the real info from a reliable source.", "Une information fournie ne correspond pas à la réelle information depuis une source fiable.", interaction.user.id, interaction.guild.id),
+ value: 'report.issue.missinfo|' + keys[1],
+ },
+ ]),
+ )
+ ]
+ });
+ } else {
+ throw new Error("Unknown Button ID");
+ }
+} \ No newline at end of file