summaryrefslogtreecommitdiff
path: root/src/commands/server/roles.ts
blob: 8ec4a0166c590b40defc9fb52ae18c6ea9526413 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { Command, CommandoMessage } from 'discord.js-commando';
import emoji from 'emoji-random'
import { MessageEmbed } from 'discord.js';
import tt from '../../utils/truncateText.js'

module.exports = class RolesServer extends Command {
    constructor(client) {
        super(client, {
            name: 'roles',
            aliases: [
                'list-roles',
                'listroles',
                'roles-list',
                'roleslist'
            ],
            group: 'server',
            memberName: 'roles',
            description: 'Lists all the roles on the current server.',
            examples: ['uwu!roles'],
            throttling: {
                usages: 5,
                duration: 30
            },
            userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
            clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
            guildOnly: true
        });
    }
    run(msg: CommandoMessage) {
        let emb = new MessageEmbed()
            .setColor(0xFFCC4D)
            .setTitle('All Roles')
            .setDescription(tt(
                msg.guild.roles
                    .cache.sort((role1, role2) => role2.position - role1.position)
                    .array()
                    .join(', ')
            ))
        msg.say(emb)
    }
};