summaryrefslogtreecommitdiff
path: root/commands/vainsocial/guild_view.js
blob: 472b2840d5d5e2bb936964d0e8faf9a0e13d3d35 (plain)
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
#!/usr/bin/node
/* jshint esnext:true */
"use strict";

const Commando = require("discord.js-commando"),
    oneLine = require("common-tags").oneLine,
    util = require("../../util"),
    GuildOverviewView = require("../../views/guild");

module.exports = class ViewGuildCommand extends Commando.Command {
    constructor(client) {
        super(client, {
            name: "vainsocial-guildview",
            aliases: ["vguild-view", "vgview", "vgv"],
            group: "vainsocial-guild",
            memberName: "vainsocial-guildview",
            description: "View members of a Guild.",
            details: oneLine`
Show a summary of your Guild.
`,
            examples: ["vgview"],

            args: [ {
                key: "name",
                label: "name",
                prompt: "Please specify your Guild's name.",
                type: "string",
                min: 3,
                default: "?"
            } ]
        });
    }
    // show Guild details
    async run(msg, args) {
        util.trackAction(msg, "vainsocial-guild-view");
        const guildOverviewView = new GuildOverviewView(msg);
        try {
            const guild = await api.getGuild(msg.author.id);
            await guildOverviewView.respond(guild);
        } catch (err) {
            return await guildOverviewView.error(err.error.err);
        }
    }
};