2022-08-28 17:03:15 +02:00
|
|
|
import { SlashCommandBuilder } from 'discord.js';
|
2022-08-17 16:22:59 +02:00
|
|
|
import db from '../../models/index.js';
|
|
|
|
const donator = db.donator;
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data: new SlashCommandBuilder()
|
|
|
|
.setName('donator')
|
|
|
|
.setDescription('All the people who donated for this bot <3'),
|
2022-08-28 17:03:15 +02:00
|
|
|
category: 'utility',
|
2022-08-17 16:22:59 +02:00
|
|
|
async execute(interaction) {
|
|
|
|
await interaction.deferReply();
|
|
|
|
const client = interaction.client;
|
|
|
|
const Donator = await donator.findAll({ order: ['id'] });
|
|
|
|
|
|
|
|
let donatorMessage = 'Thanks to:\n';
|
|
|
|
|
|
|
|
if (Donator[0]) {
|
|
|
|
for (let i = 0; i < Donator.length; i++) {
|
|
|
|
const user = await client.users.fetch(Donator[i].get('userID').toString());
|
2023-09-13 20:56:06 +02:00
|
|
|
if (user !== null) {donatorMessage += `**${user.username} (${user.id}) | ${Donator[i].get('comment')}**\n`;}
|
2022-08-17 16:22:59 +02:00
|
|
|
else {donatorMessage += `**A user of discord (${user.id}) | ${Donator[i].get('comment')} (This user no longer share a server with the bot)**\n`;}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
donatorMessage += 'No one :(';
|
|
|
|
}
|
|
|
|
|
|
|
|
return interaction.editReply(donatorMessage);
|
|
|
|
},
|
|
|
|
};
|