summaryrefslogtreecommitdiff
path: root/views/register.js
blob: 0e5ff7121060537d6c62fd62a157327fa60336a5 (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
#!/usr/bin/node
/* jshint esnext:true */
"use strict";

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

const RegisterView = module.exports;

// user register view
module.exports = class extends View {
    async text() {
        return `You are now registered at VainSocial, ${this.msg.author.mention}.`;
    }
    async help() {
        return `*${emoji.symbols.repeat} or ${util.usg(this.msg, "v")} to view your profile, ${util.usg(this.msg, "vgcreate")} to create a Guild*`
    }
    async buttons() {
        let reactions = {};
        reactions[emoji.symbols.repeat] = async () => {
            util.trackAction(this.msg, "reaction-player");
            const ign = await util.ignForUser(undefined, this.msg.author.id);
            await new PlayerView(this.msg, ign).respond();
        };
        return reactions;
    }
    async respond() {
        await api.setUser(msg.author.id, ign);
        this.response = await util.respond(this.msg,
            await this.text(), this.response);
        if (!this.hasButtons) {
            await util.reactionButtons(this.response,
                await this.buttons(player, matches));
            this.hasButtons = true;
        }
        return this.response;
    };
}