From c7c0ee4e9afd55d2a4aca208c6009461af7111d5 Mon Sep 17 00:00:00 2001 From: Dragory Date: Fri, 27 Jul 2018 20:35:20 +0300 Subject: [PATCH] Change requiredAccountAge to use hours instead of days --- CHANGELOG.md | 3 +++ README.md | 2 +- src/config.js | 2 +- src/data/threads.js | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6a4e51..3d3bf63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v2.14.0 +* Changed `requiredAccountAge` to be in hours instead of days + ## v2.13.0 * Added `requiredAccountAge` and `accountAgeDeniedMessage` options for restricting how new accounts can message modmail diff --git a/README.md b/README.md index 881713d..6622df8 100644 --- a/README.md +++ b/README.md @@ -85,5 +85,5 @@ These go in `config.json`. See also `config.example.json`. |typingProxyReverse|false|If enabled, any time a moderator is typing in a modmail thread, the user will see the bot "typing" in their DMs| |mentionRole|"here"|Role that is mentioned when new threads are created or the bot is mentioned. Accepted values are "here", "everyone", or a role id as a string. Set to null to disable these pings entirely.| |pingOnBotMention|true|If enabled, the bot will mention staff (see mentionRole above) on the inbox server when the bot is mentioned on the main server.| -|requiredAccountAge|null|Required account age for contacting modmail (in days). If the account is not old enough, a new thread will not be created and the bot will reply with `accountAgeDeniedMessage` (if set) instead.| +|requiredAccountAge|None|Required account age for contacting modmail (in hours). If the account is not old enough, a new thread will not be created and the bot will reply with `accountAgeDeniedMessage` (if set) instead.| |accountAgeDeniedMessage|"Your Discord account is not old enough to contact modmail."|See `requiredAccountAge` above| diff --git a/src/config.js b/src/config.js index 2f9e3a4..856a514 100644 --- a/src/config.js +++ b/src/config.js @@ -65,7 +65,7 @@ const defaultConfig = { "greetingMessage": null, "greetingAttachment": null, - "requiredAccountAge": null, // Amount of days + "requiredAccountAge": null, // In hours "accountAgeDeniedMessage": "Your Discord account is not old enough to contact modmail.", "relaySmallAttachmentsAsAttachments": false, diff --git a/src/data/threads.js b/src/data/threads.js index f30fc47..f4564f9 100644 --- a/src/data/threads.js +++ b/src/data/threads.js @@ -59,7 +59,7 @@ async function createNewThreadForUser(user, quiet = false) { // Check the config for a requirement of account age to contact modmail, // if the account is too young, return an optional message without making a new thread if (config.requiredAccountAge) { - if (user.createdAt > moment() - config.requiredAccountAge * 86400000){ + if (user.createdAt > moment() - config.requiredAccountAge * 3600000){ if (config.accountAgeDeniedMessage) { const privateChannel = await user.getDMChannel(); await privateChannel.createMessage(config.accountAgeDeniedMessage);