aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands/pony.js6
-rw-r--r--config/version.txt2
-rw-r--r--handler/button.js6
-rw-r--r--modules/public.js16
-rw-r--r--stats/buttons.json1
-rw-r--r--stats/commands.json1
-rw-r--r--stats/menu.json1
-rw-r--r--stats/ponies.json1
-rw-r--r--stats/queries.json1
9 files changed, 26 insertions, 9 deletions
diff --git a/commands/pony.js b/commands/pony.js
index 4654b12..ef29fb9 100644
--- a/commands/pony.js
+++ b/commands/pony.js
@@ -7,6 +7,7 @@ const list = Object.keys(JSON.parse(fs.readFileSync("./data/data.json").toString
const getResult = require('../modules/result');
const getEmbed = require('../modules/embed');
const getPixel = require("../modules/pixel");
+const getPublic = require('../modules/public');
const official = fs.readFileSync("./config/official.txt").toString().replace(/\r\n/g, "\n").split("\n");
const fpserver = fs.readFileSync("./config/fpserver.txt").toString().trim();
@@ -35,10 +36,7 @@ module.exports = async (interaction) => {
if (interaction.guild) {
row = new MessageActionRow()
.addComponents(
- new MessageButton()
- .setCustomId("pony.public|" + keys[1])
- .setLabel(l("Show to everypony", "Afficher à tous", interaction.user.id, interaction.guild ? interaction.guild.id : 0))
- .setStyle("PRIMARY"),
+ getPublic(interaction, keys),
new MessageButton()
.setLabel(l("Read More", "Lire plus", interaction.user.id, interaction.guild ? interaction.guild.id : 0))
.setStyle("LINK")
diff --git a/config/version.txt b/config/version.txt
index 8bd7d68..e937bfd 100644
--- a/config/version.txt
+++ b/config/version.txt
@@ -1 +1 @@
-1.2.40 \ No newline at end of file
+1.3.41 \ No newline at end of file
diff --git a/handler/button.js b/handler/button.js
index c5cfb19..3fbebbe 100644
--- a/handler/button.js
+++ b/handler/button.js
@@ -4,6 +4,7 @@ const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed, Messag
const getPixel = require('../modules/pixel.js');
const getEmbed = require("../modules/embed");
+const getPublic = require("../modules/public");
module.exports = async (interaction) => {
keys = interaction.customId.split("|")
@@ -26,10 +27,7 @@ module.exports = async (interaction) => {
if (interaction.guild) {
row = new MessageActionRow()
.addComponents(
- new MessageButton()
- .setCustomId("pony.public|" + keys[1])
- .setLabel(l("Show to everypony", "Afficher à tous", interaction.user.id, interaction.guild ? interaction.guild.id : 0))
- .setStyle("PRIMARY"),
+ getPublic(interaction, keys),
new MessageButton()
.setLabel(l("Read More", "Lire plus", interaction.user.id, interaction.guild ? interaction.guild.id : 0))
.setStyle("LINK")
diff --git a/modules/public.js b/modules/public.js
new file mode 100644
index 0000000..8c43df8
--- /dev/null
+++ b/modules/public.js
@@ -0,0 +1,16 @@
+const { MessageButton } = require("discord.js");
+
+module.exports = (interaction, keys) => {
+ if (typeof cooldowns[interaction.user.id] !== "undefined" && new Date() - cooldowns[interaction.user.id] < 30000) {
+ return new MessageButton()
+ .setCustomId("pony.public|" + keys[1])
+ .setLabel(l("Wait " + Math.ceil((30000 - (new Date() - cooldowns[interaction.user.id]))/1000) + " seconds", "Patientez " + Math.ceil((30000 - (new Date() - cooldowns[interaction.user.id]))/1000) + " secondes", interaction.user.id, interaction.guild ? interaction.guild.id : 0))
+ .setStyle("PRIMARY")
+ .setDisabled(true);
+ } else {
+ return new MessageButton()
+ .setCustomId("pony.public|" + keys[1])
+ .setLabel(l("Show to everypony", "Afficher à tous", interaction.user.id, interaction.guild ? interaction.guild.id : 0))
+ .setStyle("PRIMARY")
+ }
+} \ No newline at end of file
diff --git a/stats/buttons.json b/stats/buttons.json
new file mode 100644
index 0000000..4ae0ecc
--- /dev/null
+++ b/stats/buttons.json
@@ -0,0 +1 @@
+{"pony.public":3,"pony.display":1} \ No newline at end of file
diff --git a/stats/commands.json b/stats/commands.json
new file mode 100644
index 0000000..939829e
--- /dev/null
+++ b/stats/commands.json
@@ -0,0 +1 @@
+{"pony":6,"config":1} \ No newline at end of file
diff --git a/stats/menu.json b/stats/menu.json
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/stats/menu.json
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/stats/ponies.json b/stats/ponies.json
new file mode 100644
index 0000000..3cb2885
--- /dev/null
+++ b/stats/ponies.json
@@ -0,0 +1 @@
+{"Scootaloo":3,"Rainbow Dash":2,"Cheerilee":1} \ No newline at end of file
diff --git a/stats/queries.json b/stats/queries.json
new file mode 100644
index 0000000..628240b
--- /dev/null
+++ b/stats/queries.json
@@ -0,0 +1 @@
+{"Scootaloo":["scootaloo"],"Rainbow Dash":["rainbow dash","rd"],"Cheerilee":["cheerilee"]} \ No newline at end of file