Haha-Yes/event/listeners/commandstarted.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

2019-03-31 19:17:50 +02:00
const { Listener } = require('discord-akairo');
let serverID = require('../../json/serverID.json');
2019-03-31 19:17:50 +02:00
class commandStartedListener extends Listener {
constructor() {
super('commandStarted', {
emitter: 'commandHandler',
event: 'commandStarted'
});
}
async exec(message) {
2019-03-31 17:31:47 +02:00
//This is for april fools
let today = new Date();
let dd = today.getDate();
let mm = today.getMonth() + 1; //January is 0!
if (dd < 10) {
dd = '0' + dd;
}
if (mm < 10) {
mm = '0' + mm;
}
today = dd + '/' + mm;
//Only execute when its april first
if (today == '01/04' && !serverID.includes(message.guild.id)) {
2019-03-31 17:31:47 +02:00
let count = Math.random() * 100;
2019-04-01 00:06:34 +02:00
if (count < 10) {
serverID.push(message.guild.id);
2019-03-31 20:38:54 +02:00
console.log('Gold triggered!');
2019-03-31 20:41:19 +02:00
this.client.user.setActivity('people buy haha yes gold™', { type: 'WATCHING' });
2020-03-02 14:40:09 +01:00
let Embed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle('Haha yes **gold**')
.setDescription('To further utilize this command, please visit https://namejeff.xyz/gold')
.attachFiles(['./asset/img/gold.png'])
.setImage('attachment://gold.png')
.setFooter('This is an april fool\'s joke, no command will EVER be behind a paywall');
return message.channel.send(Embed);
2019-03-31 17:31:47 +02:00
}
2019-03-31 19:17:50 +02:00
}
}
}
module.exports = commandStartedListener;