Rename account age options

master
Dragory 2018-07-27 19:48:45 +03:00
parent 4a1f3b0bd5
commit 1aa4abd62e
3 changed files with 10 additions and 13 deletions

View File

@ -84,9 +84,6 @@ These go in `config.json`. See also `config.example.json`.
|typingProxy|false|If enabled, any time a user is typing to modmail in their DMs, the modmail thread will show the bot as "typing"| |typingProxy|false|If enabled, any time a user is typing to modmail in their DMs, the modmail thread will show the bot as "typing"|
|typingProxyReverse|false|If enabled, any time a moderator is typing in a modmail thread, the user will see the bot "typing" in their DMs| |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.| |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.|
<<<<<<< HEAD
|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.| |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.|
|userOlderThan|null|The amount of days the user's account has to exist. If the user's account is not old enough, the bot will not make a new thread and reply to the user with the message defined in `userDeniedMessage`.| |accountAgeDeniedMessage|"Your Discord account is not old enough to contact modmail."|See `requiredAccountAge` above|
|userDeniedMessage|"Your Discord account is not old enough to contact modmail."|The message to reply to a user when their account is not old enough to contact modmail.|
>>>>>>> 9c1a5863f52d51a40e480efcdbd2275a7e3b4978

View File

@ -65,8 +65,8 @@ const defaultConfig = {
"greetingMessage": null, "greetingMessage": null,
"greetingAttachment": null, "greetingAttachment": null,
"userOlderThan": null, // Amount of days "requiredAccountAge": null, // Amount of days
"userDeniedMessage": "Your Discord account is not old enough to contact modmail.", "accountAgeDeniedMessage": "Your Discord account is not old enough to contact modmail.",
"relaySmallAttachmentsAsAttachments": false, "relaySmallAttachmentsAsAttachments": false,

View File

@ -58,14 +58,14 @@ async function createNewThreadForUser(user, quiet = false) {
// Check the config for a requirement of account age to contact modmail, // 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 the account is too young, return an optional message without making a new thread
if (config.userOlderThan) { if (config.requiredAccountAge) {
if (user.createdAt > moment() - config.userOlderThan * 86400000){ if (user.createdAt > moment() - config.requiredAccountAge * 86400000){
if (config.userDeniedMessage) { if (config.accountAgeDeniedMessage) {
const privateChannel = await user.getDMChannel(); const privateChannel = await user.getDMChannel();
await privateChannel.createMessage(config.userDeniedMessage); await privateChannel.createMessage(config.accountAgeDeniedMessage);
} }
return; return;
} }
} }
// Use the user's name+discrim for the thread channel's name // Use the user's name+discrim for the thread channel's name
@ -133,7 +133,7 @@ async function createNewThreadForUser(user, quiet = false) {
// Guild info // Guild info
const guildInfoHeaderItems = new Map(); const guildInfoHeaderItems = new Map();
const mainGuilds = utils.getMainGuilds(); const mainGuilds = utils.getMainGuilds();
mainGuilds.forEach(guild => { mainGuilds.forEach(guild => {
const member = guild.members.get(user.id); const member = guild.members.get(user.id);
if (! member) return; if (! member) return;