diff options
Diffstat (limited to 'views/guild_add.js')
| -rw-r--r-- | views/guild_add.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/views/guild_add.js b/views/guild_add.js new file mode 100644 index 0000000..cb32dc3 --- /dev/null +++ b/views/guild_add.js @@ -0,0 +1,34 @@ +#!/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 GuildAddView = module.exports; + +// match detail view +module.exports = class extends View { + constructor(msg, players) { + super(msg); + this.players = players; + } + + // players: obj, key=ign, value=player + async text(players) { + return Object.entries(players).map((tuple) => + (tuple[1] == undefined)? + `Loading ${tuple[0]}…` + : `Loaded ${tuple[0]}.` + ).join("\n"); + } + + async respond() { + this.response = await util.respond(this.msg, + await this.text(this.players), this.response); + return this.response; + }; +} |
