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

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

const GuildMemberView = module.exports;

// combined fame + profile + last match
module.exports = class extends View {
    text(member) {
        return `${member.player.name} | ${member.status} | ${member.fame} VS Fame`;
    }

    async embed(member, player, matches) {
        const embed = util.vainsocialEmbed(`${member.player.name} - ${member.player.shard_id}`,
            "", "vainsocial-guild-memberview")
            .addField("Guild Profile", await this.text(member))
            .addField("Player Profile", await new PlayerView().text(player))
            .addField("Last Match", await new MatchesView().text(matches[0]));
        return embed;
    }

    async respond(member, player, matches) {
        this.response = await util.respond(this.msg,
            await this.embed(member, player, matches), this.response);
        return this.response;
    }
}