summaryrefslogtreecommitdiff
path: root/views/guild_create.js
blob: 8e7be81a7ea06f667f7de2a268209bc5ea21e5da (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
45
46
47
48
49
#!/usr/bin/node
/* jshint esnext:true */
"use strict";

const emoji = require("discord-emoji"),
    View = require("./view"),
    util = require("../util"),
    api = require("../api"),
    strings = require("../strings"),
    oneLine = require("common-tags").oneLine;

const GuildCreateView = module.exports;

// match detail view
module.exports = class extends View {
    constructor(msg, user_token) {
        super(msg);
        this.user_token = user_token;
    }

    async text() {
        return `Guild created. You can now use ${util.usg(this.msg, "vgadd ign1 ign2 ignN")} to add members to your Guild.`;
    }

    async help() {
        return `*${emoji.symbols.information_source} or ${util.usg(this.msg, "vgview")} to view your Guild*`
    }

    async buttons() {
        let reactions = {};
        reactions[emoji.symbols.information_source] = async () => {
            util.trackAction(this.msg, "reaction-guildview");
            await new GuildOverviewView(this.msg).respond(this.user_token);
        };
        return reactions;
    }

    // TODO move to super class
    async respond() {
        this.response = await util.respond(this.msg,
            await this.text(), this.response);
        if (!this.hasButtons) {
            await util.reactionButtons(this.response,
                await this.buttons());
            this.hasButtons = true;
        }
        return this.response;
    };
}