Haha-Yes/commands/utility/donator.js

39 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

const { Command } = require('discord-akairo');
2019-10-27 00:55:13 +02:00
const donator = require('../../models').donator;
class donatorCommand extends Command {
constructor() {
super('donator', {
2020-06-15 16:48:35 +02:00
aliases: ['donator', 'donators'],
category: 'utility',
2019-11-09 12:04:01 +01:00
clientPermissions: ['SEND_MESSAGES'],
description: {
content: 'All the people who donated for this bot <3',
usage: '',
examples: ['']
}
});
}
async exec(message) {
2019-10-27 00:55:13 +02:00
const Donator = await donator.findAll({order: ['id']});
let donatorMessage = 'Thanks to:\n';
if (Donator[0]) {
for (let i = 0; i < Donator.length; i++) {
if (this.client.users.resolve(Donator[i].get('userID').toString()) !== null)
donatorMessage += `**${this.client.users.resolve(Donator[i].get('userID').toString()).tag} (${Donator[i].get('userID')}) | ${Donator[i].get('comment')}**\n`;
2020-08-03 11:26:20 +02:00
else
donatorMessage += `**A user of discord (${Donator[i].get('userID')}) | ${Donator[i].get('comment')} (This user no longer share a server with the bot)**\n`;
}
} else {
donatorMessage += 'No one :(';
2019-10-27 00:55:13 +02:00
}
return message.reply(donatorMessage);
}
}
module.exports = donatorCommand;