2019-10-27 00:26:37 +02:00
const { Command } = require ( 'discord-akairo' ) ;
2019-10-27 00:55:13 +02:00
const donator = require ( '../../models' ) . donator ;
2019-10-27 00:26:37 +02:00
class donatorCommand extends Command {
constructor ( ) {
super ( 'donator' , {
2020-06-15 16:48:35 +02:00
aliases : [ 'donator' , 'donators' ] ,
2019-10-27 00:26:37 +02:00
category : 'utility' ,
2019-11-09 12:04:01 +01:00
clientPermissions : [ 'SEND_MESSAGES' ] ,
2019-10-27 00:26:37 +02:00
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' ;
2019-10-27 13:15:31 +01:00
if ( Donator [ 0 ] ) {
for ( let i = 0 ; i < Donator . length ; i ++ ) {
2020-11-05 20:58:33 +01:00
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 ` ;
2019-10-27 13:15:31 +01:00
}
} else {
donatorMessage += 'No one :(' ;
2019-10-27 00:55:13 +02:00
}
2021-07-23 04:19:47 +02:00
return message . reply ( donatorMessage ) ;
2019-10-27 00:26:37 +02:00
}
}
module . exports = donatorCommand ;