From 706cd5521b7746a9a5f21a12269f28e662fb210e Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 21 Jun 2020 11:41:10 -0400 Subject: [PATCH] Timer Command --- README.md | 3 ++- commands/other/timer.js | 29 +++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 commands/other/timer.js diff --git a/README.md b/README.md index 51c94af9..9bae1875 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 498 +Total: 499 ### Utility: @@ -767,6 +767,7 @@ Total: 498 * **screenshot:** Takes a screenshot of any webpage. * **smilebasic:** Responds with a ZIP file for a SmileBASIC project. * **strawpoll:** Generates a Strawpoll with the options you provide. +* **timer:** Sets a timer for anywhere from 1 second to 10 minutes. ### Roleplay: diff --git a/commands/other/timer.js b/commands/other/timer.js new file mode 100644 index 00000000..ad1152ff --- /dev/null +++ b/commands/other/timer.js @@ -0,0 +1,29 @@ +const Command = require('../../structures/Command'); +const { delay } = require('../../util/Util'); + +module.exports = class TimerCommand extends Command { + constructor(client) { + super(client, { + name: 'timer', + group: 'other', + memberName: 'timer', + description: 'Sets a timer for anywhere from 1 second to 10 minutes.', + args: [ + { + key: 'time', + prompt: 'How long should the timer last (in seconds)?', + type: 'integer', + max: 600, + min: 1 + } + ] + }); + } + + async run(msg, { time }) { + const display = time > 59 ? `${time / 60} minutes` : `${time} seconds`; + await msg.say(`🕰️ Set a timer for **${display}**.`); + await delay(time / 1000); + return msg.say(`🕰️ Your **${display}** timer is finished!`); + } +}; diff --git a/package.json b/package.json index 64543b0d..cdd79dfd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "116.36.1", + "version": "116.37.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {