From 68a3e88a1e603744f9d46396e1e0d94087a49ff7 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Mon, 2 Mar 2020 16:06:15 +0100 Subject: [PATCH] Don't make the april fool joke play twice --- event/listeners/commandstarted.js | 6 +++++- json/serverID.json | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 json/serverID.json diff --git a/event/listeners/commandstarted.js b/event/listeners/commandstarted.js index ab27158..f04b7ec 100644 --- a/event/listeners/commandstarted.js +++ b/event/listeners/commandstarted.js @@ -1,4 +1,5 @@ const { Listener } = require('discord-akairo'); +let serverID = require('../../json/serverID.json'); class commandStartedListener extends Listener { constructor() { @@ -22,9 +23,10 @@ class commandStartedListener extends Listener { } today = dd + '/' + mm; //Only execute when its april first - if (today == '01/04') { + if (today == '01/04' && !serverID.includes(message.guild.id)) { let count = Math.random() * 100; if (count < 10) { + serverID.push(message.guild.id); console.log('Gold triggered!'); this.client.user.setActivity('people buy haha yes gold™', { type: 'WATCHING' }); let Embed = this.client.util.embed() @@ -37,6 +39,8 @@ class commandStartedListener extends Listener { return message.channel.send(Embed); } + } else { + console.log('Gold already triggered for this guild!'); } } } diff --git a/json/serverID.json b/json/serverID.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/json/serverID.json @@ -0,0 +1 @@ +[] \ No newline at end of file