From 8316723a6a9bad1e6be87ee8d0d75dc147888750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Mon, 6 Sep 2021 19:43:14 +0300 Subject: [PATCH] Added reload stations option in maintenance command --- src/client/commands/maintenance.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/client/commands/maintenance.js b/src/client/commands/maintenance.js index 111e04d..09923e6 100644 --- a/src/client/commands/maintenance.js +++ b/src/client/commands/maintenance.js @@ -41,6 +41,12 @@ module.exports = { description: "", value: "6" }, + { + emoji: "<:RadioXList:688541155519889482>", + label: "Reload Stations", + description: "", + value: "7" + }, { emoji: "<:dnd:746069698139127831>", label: "Enable Maintenance Mode", @@ -108,6 +114,18 @@ module.exports = { require(`../commands.js`).execute(client); client.user.setStatus('online'); break; + case "7": + try { + client.funcs.logger('Stations', 'Started fetching list – ' + client.config.stationslistUrl); + client.stations = await fetch(client.config.stationslistUrl) + .then(client.funcs.checkFetchStatus) + .then(response => response.json()); + + client.funcs.logger('Stations', 'Successfully fetched list'); + } catch (error) { + client.funcs.logger('Stations', 'Fetching list failed'); + } + break; case "8": client.user.setStatus('dnd'); break;