From 0c9302b41b29b8e206c8d1d141d55f51627fd90a Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Wed, 23 Sep 2020 00:58:18 +0300 Subject: [PATCH] Add statusType option --- docs/configuration.md | 6 +++++- src/data/cfg.jsdoc.js | 1 + src/data/cfg.schema.json | 5 +++++ src/main.js | 11 ++++++++++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 8ac6cd1..b1ed910 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -290,7 +290,11 @@ Prefix to use snippets anonymously #### status **Default:** `Message me for help` -The bot's "Playing" text +The bot's status text. Set to an empty value - `status = ""` - to disable. + +#### statusType +**Default:** `playing` +The bot's status type. One of `playing`, `watching`, `listening`. #### syncPermissionsOnMove **Default:** `on` diff --git a/src/data/cfg.jsdoc.js b/src/data/cfg.jsdoc.js index d04ea58..7b86312 100644 --- a/src/data/cfg.jsdoc.js +++ b/src/data/cfg.jsdoc.js @@ -10,6 +10,7 @@ * @property {string} [snippetPrefix="!!"] * @property {string} [snippetPrefixAnon="!!!"] * @property {string} [status="Message me for help!"] + * @property {"playing"|"watching"|"listening"} [statusType="playing"] * @property {string} [responseMessage="Thank you for your message! Our mod team will reply to you here as soon as possible."] * @property {string} [closeMessage] * @property {boolean} [allowUserClose=false] diff --git a/src/data/cfg.schema.json b/src/data/cfg.schema.json index 57a36fd..697d2f4 100644 --- a/src/data/cfg.schema.json +++ b/src/data/cfg.schema.json @@ -81,6 +81,11 @@ "type": "string", "default": "Message me for help!" }, + "statusType": { + "type": "string", + "enum": ["playing", "watching", "listening"], + "default": "playing" + }, "responseMessage": { "$ref": "#/definitions/multilineString", "default": "Thank you for your message! Our mod team will reply to you here as soon as possible." diff --git a/src/main.js b/src/main.js index 70d11e8..02e8cd2 100644 --- a/src/main.js +++ b/src/main.js @@ -103,7 +103,16 @@ function waitForGuild(guildId) { function initStatus() { function applyStatus() { - bot.editStatus(null, {name: config.status}); + const type = { + "playing": 0, + "watching": 3, + "listening": 2, + }[config.statusType] || 0; + bot.editStatus(null, {name: config.status, type}); + } + + if (config.status == null || config.status === "") { + return; } // Set the bot status initially, then reapply it every hour since in some cases it gets unset