summaryrefslogtreecommitdiff
path: root/views/guild_progress.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-05-09 18:02:15 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-05-09 18:03:06 +0200
commit0ee8e0e5239e3f76911834da54d2c72a4a149804 (patch)
treefca810d542ffad451699379a8dc61067c7ea632b /views/guild_progress.js
parent94adb2f9f182e50f6d60aadc70bb8bf8f74f2371 (diff)
downloaddiscordbot-0ee8e0e5239e3f76911834da54d2c72a4a149804.tar.gz
discordbot-0ee8e0e5239e3f76911834da54d2c72a4a149804.zip
error handling, migration to template
Diffstat (limited to 'views/guild_progress.js')
-rw-r--r--views/guild_progress.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/views/guild_progress.js b/views/guild_progress.js
new file mode 100644
index 0000000..163c627
--- /dev/null
+++ b/views/guild_progress.js
@@ -0,0 +1,33 @@
+#!/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=player
+ async text(players) {
+ return Object.entries(players).map((tuple) =>
+ (tuple[1] == undefined)?
+ `Loading ${tuple[0]}…`
+ : `Loaded ${tuple[0]}.`
+ ).join("\n");
+ }
+
+ async respond(extra="") {
+ this.response = await util.respond(this.msg,
+ await this.text(this.players) + "\n" + extra, this.response);
+ return this.response;
+ };
+}