summaryrefslogtreecommitdiff
path: root/views/guild_progress.js
blob: b3fdeb32023b6bc85b80d217ab21c44ec257d7cf (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
#!/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 GuildMembersProgressView = module.exports;

module.exports = class extends View {
    constructor(msg, players) {
        super(msg);
        this.players = players;
    }

    // players: obj, key=ign, value=progress
    async text(players) {
        return Object.entries(players).map((tuple) =>
            `${tuple[0]}: ${tuple[1]}`).join("\n");
    }

    async respond(extra="") {
        this.response = await util.respond(this.msg,
            await this.text(this.players) + "\n" + extra, this.response);
        return this.response;
    };
}