Don't make the april fool joke play twice

This commit is contained in:
loicbersier 2020-03-02 16:06:15 +01:00
parent b0b663b8d0
commit 68a3e88a1e
2 changed files with 6 additions and 1 deletions

View file

@ -1,4 +1,5 @@
const { Listener } = require('discord-akairo'); const { Listener } = require('discord-akairo');
let serverID = require('../../json/serverID.json');
class commandStartedListener extends Listener { class commandStartedListener extends Listener {
constructor() { constructor() {
@ -22,9 +23,10 @@ class commandStartedListener extends Listener {
} }
today = dd + '/' + mm; today = dd + '/' + mm;
//Only execute when its april first //Only execute when its april first
if (today == '01/04') { if (today == '01/04' && !serverID.includes(message.guild.id)) {
let count = Math.random() * 100; let count = Math.random() * 100;
if (count < 10) { if (count < 10) {
serverID.push(message.guild.id);
console.log('Gold triggered!'); console.log('Gold triggered!');
this.client.user.setActivity('people buy haha yes gold™', { type: 'WATCHING' }); this.client.user.setActivity('people buy haha yes gold™', { type: 'WATCHING' });
let Embed = this.client.util.embed() let Embed = this.client.util.embed()
@ -37,6 +39,8 @@ class commandStartedListener extends Listener {
return message.channel.send(Embed); return message.channel.send(Embed);
} }
} else {
console.log('Gold already triggered for this guild!');
} }
} }
} }

1
json/serverID.json Normal file
View file

@ -0,0 +1 @@
[]