summaryrefslogtreecommitdiff
path: root/src/commands/server/roleinfo.ts
blob: 3fc381446115ca080c50dfe79f0acebb1adb90de (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Command, CommandoMessage } from 'discord.js-commando';
import emoji from 'emoji-random'
import { MessageEmbed } from 'discord.js';

module.exports = class RoleInfoServer extends Command {
    constructor(client) {
        super(client, {
            name: 'roleinfo',
            aliases: [
                'role-info'
            ],
            group: 'fun',
            memberName: 'roleinfo',
            description: 'Gets information on a specified role.',
            examples: ['uwu!roleinfo @Role'],
            throttling: {
                usages: 5,
                duration: 30
            },
            userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
            clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
            guildOnly: true,
            args: [
                {
                    key: 'rRole',
                    prompt: 'What role would you like to get information on?',
                    type: 'role'
                }
            ]
        });
    }
    run(msg: CommandoMessage, { rRole }) {
        let emb = new MessageEmbed()
            .setColor(0xFFCC4D)
            .setTitle(`${rRole.name} (${rRole.id})`)
            .setTimestamp(rRole.createdAt)
            .addFields([
                {
                    name: '🔢 Position',
                    value: `${rRole.position + 1} (raw position: ${rRole.rawPosition})`
                },
                {
                    name: '**@** Mentionable',
                    value: rRole.mentionable ? 'Yes' : 'No'
                },
                {
                    name: "💡 Display separately",
                    value: rRole.hoist ? "Yes" : "No"
                },
                {
                    name: "👥 Members",
                    value: rRole.members.size
                },
                {
                    name: "🔍 Color",
                    value: `Use ${msg.anyUsage(`color ${rRole.hexColor}`)}`
                }
            ])
        msg.say(emb)
    }
};