diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-05-08 23:15:33 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-05-08 23:15:33 +0200 |
| commit | 31b4764cd5233acb25f4d0027261fe83eaad6ec7 (patch) | |
| tree | 75e7c33b8284d711fb9208154a1d8db8b931a0f3 /views/view.js | |
| parent | f3aa08e72c6ffdb942ea06e21ac19e28b8cd5550 (diff) | |
| download | discordbot-31b4764cd5233acb25f4d0027261fe83eaad6ec7.tar.gz discordbot-31b4764cd5233acb25f4d0027261fe83eaad6ec7.zip | |
rewrite the whole thing (wip)
Diffstat (limited to 'views/view.js')
| -rw-r--r-- | views/view.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/views/view.js b/views/view.js new file mode 100644 index 0000000..3d3ae38 --- /dev/null +++ b/views/view.js @@ -0,0 +1,39 @@ +#!/usr/bin/node +/* jshint esnext:true */ +"use strict"; + +const util = require("../util"); + +module.exports = class { + constructor(msg) { + // command message + this.msg = msg; + // response (d'oh) + this.response = undefined; + this.hasButtons = false; + } + static async text() { + // return the markdown or an array of [title, markdown] + return ""; + } + async embed() { + // return an embed using `text()` and `help()` + return util.vainsocialEmbed("title", "url"); + } + async help() { + // return explanation for buttons + return ""; + } + async buttons() { + // return buttons pointing to different views + // key: emoji, value: async func + return {}; + } + async respond() { + // reply with embed + buttons + this.response = await util.respond(this.msg, + await this.embed(), this.response); + await util.reactionButtons(this.response, await this.buttons(), this.msg); + return this.response; + } +}; |
