bunch of shit
This commit is contained in:
parent
bb0655da79
commit
2fd1085d60
@ -29,7 +29,7 @@
|
|||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"escape-string-regexp": "4.0.0",
|
"escape-string-regexp": "4.0.0",
|
||||||
"humanize-duration": "^3.27.1",
|
"humanize-duration": "^3.27.1",
|
||||||
"moment": "^2.29.2",
|
"moment": "^2.29.3",
|
||||||
"mongodb": "^4.5.0",
|
"mongodb": "^4.5.0",
|
||||||
"node-fetch": "2",
|
"node-fetch": "2",
|
||||||
"object-hash": "^3.0.0",
|
"object-hash": "^3.0.0",
|
||||||
|
@ -504,6 +504,7 @@
|
|||||||
"blobsob",
|
"blobsob",
|
||||||
"poggers",
|
"poggers",
|
||||||
"night",
|
"night",
|
||||||
|
"nights",
|
||||||
"nightmare",
|
"nightmare",
|
||||||
"nightmares",
|
"nightmares",
|
||||||
"nightcore",
|
"nightcore",
|
||||||
|
@ -331,41 +331,38 @@ If you absolutely need this, contact a bot developer in our support server.
|
|||||||
[COMMAND_CASE_HELP]
|
[COMMAND_CASE_HELP]
|
||||||
View a specific case
|
View a specific case
|
||||||
|
|
||||||
[C_CASE_INVALID]
|
[COMMAND_CASE_NOTFOUND]
|
||||||
Case ID `{caseID}` is invalid! Make sure it's an integer above 0.
|
|
||||||
|
|
||||||
[C_CASE_NOTFOUND]
|
|
||||||
No case matching ID `{caseID}` was found.
|
No case matching ID `{caseID}` was found.
|
||||||
|
|
||||||
[C_CASE_TITLE]
|
[COMMAND_CASE_TITLE]
|
||||||
{emoji_book} Case **#{caseID}**
|
{emoji_book} Case **#{caseID}**
|
||||||
|
|
||||||
[C_CASE_TITLE_VERBOSE]
|
[COMMAND_CASE_TITLE_VERBOSE]
|
||||||
{emoji_book} Case **#{caseID} (verbose)**
|
{emoji_book} Case **#{caseID} (verbose)**
|
||||||
|
|
||||||
[C_CASE_CHANGES_TITLE]
|
[COMMAND_CASE_CHANGES_TITLE]
|
||||||
{emoji_note} Changes to case **#{case}**
|
{emoji_note} Changes to case **#{case}**
|
||||||
|
|
||||||
[C_CASE_CHANGES_NONE]
|
[COMMAND_CASE_CHANGES_NONE]
|
||||||
No changes have been made to the case.
|
No changes have been made to the case.
|
||||||
|
|
||||||
[C_CASE_CHANGE_BASE]
|
[COMMAND_CASE_CHANGE_BASE]
|
||||||
**Timestamp:** {date} | {timeAgo} ago
|
**Timestamp:** {date} | {timeAgo} ago
|
||||||
**Staff:** {staff}
|
**Staff:** {staff}
|
||||||
|
|
||||||
[C_CASE_CHANGES_RESOLVE]
|
[COMMAND_CASE_CHANGES_RESOLVE]
|
||||||
**Reason:** {reason}
|
**Reason:** {reason}
|
||||||
|
|
||||||
[C_CASE_CHANGES_REASON]
|
[COMMAND_CASE_CHANGES_REASON]
|
||||||
**Old reason:** {reason}
|
**Old reason:** {reason}
|
||||||
|
|
||||||
[C_CASE_CHANGES_DURATION]
|
[COMMAND_CASE_CHANGES_DURATION]
|
||||||
**Old duration:** {duration}
|
**Old duration:** {duration}
|
||||||
|
|
||||||
[C_CASE_CHANGE_NOREASON]
|
[COMMAND_CASE_CHANGE_NOREASON]
|
||||||
`No reason given`
|
`No reason given`
|
||||||
|
|
||||||
[C_CASE_TEMPLATE]
|
[COMMAND_CASE_TEMPLATE]
|
||||||
**[Jump to message (if available)](https://discord.com/channels/{guild}/{channel}/{message})**
|
**[Jump to message (if available)](https://discord.com/channels/{guild}/{channel}/{message})**
|
||||||
|
|
||||||
**Unique ID:** {uniqueID}
|
**Unique ID:** {uniqueID}
|
||||||
@ -375,7 +372,7 @@ No changes have been made to the case.
|
|||||||
**Staff:** {staff}
|
**Staff:** {staff}
|
||||||
**Changes:** {nrChanges}
|
**Changes:** {nrChanges}
|
||||||
|
|
||||||
[C_CASE_TEMPLATE_VERBOSE]
|
[COMMAND_CASE_TEMPLATE_VERBOSE]
|
||||||
**[Jump to message (if available)](https://discord.com/channels/{guild}/{channel}/{message})**
|
**[Jump to message (if available)](https://discord.com/channels/{guild}/{channel}/{message})**
|
||||||
**Unique ID:** {uniqueID}
|
**Unique ID:** {uniqueID}
|
||||||
**Type:** {type}
|
**Type:** {type}
|
||||||
@ -386,34 +383,34 @@ No changes have been made to the case.
|
|||||||
**Amount of changes:** {nrChanges}
|
**Amount of changes:** {nrChanges}
|
||||||
**Changes:** {changes}
|
**Changes:** {changes}
|
||||||
|
|
||||||
[C_CASE_MODPOINTS]
|
[COMMAND_CASE_MODPOINTS]
|
||||||
**Points:** {points}
|
**Points:** {points}
|
||||||
**Expires:** {expires}
|
**Expires:** {expires}
|
||||||
|
|
||||||
[C_CASE_REASON]
|
[COMMAND_CASE_REASON]
|
||||||
**Reason:**
|
**Reason:**
|
||||||
```{reason}```
|
```{reason}```
|
||||||
|
|
||||||
[C_CASE_SLOWMODE]
|
[COMMAND_CASE_SLOWMODE]
|
||||||
**Slowmode:** {readable}
|
**Slowmode:** {readable}
|
||||||
|
|
||||||
[C_CASE_SLOWMODE_VERBOSE]
|
[COMMAND_CASE_SLOWMODE_VERBOSE]
|
||||||
**Slowmode:** {readable} ({seconds}) seconds
|
**Slowmode:** {readable} ({seconds}) seconds
|
||||||
|
|
||||||
[C_CASE_TARGET_USER]
|
[COMMAND_CASE_TARGET_USER]
|
||||||
**User:** {target}
|
**User:** {target}
|
||||||
|
|
||||||
[C_CASE_TARGET_CHANNEL]
|
[COMMAND_CASE_TARGET_CHANNEL]
|
||||||
**Channel:** #{target}
|
**Channel:** #{target}
|
||||||
|
|
||||||
[C_CASE_TARGET_USER_VERBOSE]
|
[COMMAND_CASE_TARGET_USER_VERBOSE]
|
||||||
**User:** {target} ({targetID})
|
**User:** {target} ({targetID})
|
||||||
|
|
||||||
[C_CASE_TARGET_CHANNEL_VERBOSE]
|
[COMMAND_CASE_TARGET_CHANNEL_VERBOSE]
|
||||||
**Channel:** #{target} ({targetID})
|
**Channel:** #{target} ({targetID})
|
||||||
|
|
||||||
[C_CASE_LENGTH]
|
[COMMAND_CASE_LENGTH]
|
||||||
**Length:** {time}
|
**Length:** {time}
|
||||||
|
|
||||||
[C_CASE_LENGTH_VERBOSE]
|
[COMMAND_CASE_LENGTH_VERBOSE]
|
||||||
**Length:** {time} ({inSeconds} seconds)
|
**Length:** {time} ({inSeconds} seconds)
|
@ -32,6 +32,9 @@ The command option {option} requires a command or setting.
|
|||||||
[O_COMMANDHANDLER_DEPEDENCY]
|
[O_COMMANDHANDLER_DEPEDENCY]
|
||||||
The command option **{option}** depends on another option: **{dependency}**.
|
The command option **{option}** depends on another option: **{dependency}**.
|
||||||
|
|
||||||
|
[O_COMMANDHANDLER_REQUIRED]
|
||||||
|
Option **{option}** is required.
|
||||||
|
|
||||||
[O_COMMANDHANDLER_ERROR]
|
[O_COMMANDHANDLER_ERROR]
|
||||||
An error occured while executing that command.
|
An error occured while executing that command.
|
||||||
It is recommended to contact a developer about this issue.
|
It is recommended to contact a developer about this issue.
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const timestring = require('timestring');
|
const timestring = require('timestring');
|
||||||
|
const moment = require('moment');
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
// const { DiscordClient } = require('../DiscordClient');
|
// const { DiscordClient } = require('../DiscordClient');
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
@ -60,6 +61,20 @@ class Resolver {
|
|||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resolveDate(string) {
|
||||||
|
let date = null;
|
||||||
|
const matches = string.match(/([0-9]{4}(?:\/|-)[0-9]{1,2}(?:\/|-)[0-9]{1,2})/gimu); //YYYY-MM-DD is REQUIRED.
|
||||||
|
if (matches && matches.length > 0) {
|
||||||
|
try {
|
||||||
|
const string = matches[0].replace(/\//giu, '-');
|
||||||
|
date = moment(string);
|
||||||
|
} catch (error) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve several user resolveables
|
* Resolve several user resolveables
|
||||||
*
|
*
|
||||||
|
@ -124,6 +124,8 @@ class InvokerWrapper {
|
|||||||
|
|
||||||
if (this.deferred && !this.replied) options._edit = true;
|
if (this.deferred && !this.replied) options._edit = true;
|
||||||
|
|
||||||
|
if(options.embed) options.embeds = [options.embed];
|
||||||
|
|
||||||
if (options.embeds) options.embeds.forEach((embed) => {
|
if (options.embeds) options.embeds.forEach((embed) => {
|
||||||
if (!embed.color) embed.color = 619452;
|
if (!embed.color) embed.color = 619452;
|
||||||
});
|
});
|
||||||
|
@ -89,6 +89,9 @@ class CommandHandler extends Observer {
|
|||||||
});
|
});
|
||||||
if (response.dependency) content = invoker.format(`O_COMMANDHANDLER_DEPEDENCY`,
|
if (response.dependency) content = invoker.format(`O_COMMANDHANDLER_DEPEDENCY`,
|
||||||
{ option: response.option.name, dependency: response.dependency });
|
{ option: response.option.name, dependency: response.dependency });
|
||||||
|
if (response.required) content = invoker.format(`O_COMMANDHANDLER_REQUIRED`, {
|
||||||
|
option: response.option.name
|
||||||
|
});
|
||||||
return invoker.reply({
|
return invoker.reply({
|
||||||
content,
|
content,
|
||||||
emoji: 'failure',
|
emoji: 'failure',
|
||||||
@ -148,11 +151,6 @@ class CommandHandler extends Observer {
|
|||||||
|
|
||||||
const { subcommand } = interaction;
|
const { subcommand } = interaction;
|
||||||
|
|
||||||
// Handled by inhibitors -- cleanup later
|
|
||||||
// if(!interaction.guild && command.guildOnly) {
|
|
||||||
// return interaction.reply({ index: 'O_COMMANDHANDLER_GUILDONLY', emoji: 'failure', ephemeral: true });
|
|
||||||
// }
|
|
||||||
|
|
||||||
let error = null;
|
let error = null;
|
||||||
const options = {};
|
const options = {};
|
||||||
// Find the option through the subcommand incase the subcommands have options with the same name
|
// Find the option through the subcommand incase the subcommands have options with the same name
|
||||||
@ -189,6 +187,12 @@ class CommandHandler extends Observer {
|
|||||||
options[matched.name] = newOption;
|
options[matched.name] = newOption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Discord should handle this but just in case
|
||||||
|
const required = _subcommand.options.filter((opt) => opt.required);
|
||||||
|
for (const req of required) {
|
||||||
|
if(!options[req.name]) return { option: req, error: true, required: true };
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure option dependencies
|
// Ensure option dependencies
|
||||||
for (const opt of Object.values(options)) {
|
for (const opt of Object.values(options)) {
|
||||||
let hasDep = false;
|
let hasDep = false;
|
||||||
@ -344,6 +348,11 @@ class CommandHandler extends Observer {
|
|||||||
if(option.minimum !== undefined && float < option.minimum) return { error: true };
|
if(option.minimum !== undefined && float < option.minimum) return { error: true };
|
||||||
if(option.maximum !== undefined && float > option.maximum) return { error: true };
|
if(option.maximum !== undefined && float > option.maximum) return { error: true };
|
||||||
return { error: false, value: parseFloat(float) };
|
return { error: false, value: parseFloat(float) };
|
||||||
|
},
|
||||||
|
DATE: async (str) => {
|
||||||
|
const date = await this.client.resolver.resolveDate(str);
|
||||||
|
if (!date) return { error: true };
|
||||||
|
return { error: false, value: date };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ const Constants = {
|
|||||||
TEXT_CHANNELS: 3,
|
TEXT_CHANNELS: 3,
|
||||||
VOICE_CHANNELS: 3,
|
VOICE_CHANNELS: 3,
|
||||||
TIME: 3, // timestring
|
TIME: 3, // timestring
|
||||||
|
DATE: 3,
|
||||||
COMPONENT: 3,
|
COMPONENT: 3,
|
||||||
STRING: 3,
|
STRING: 3,
|
||||||
INTEGER: 4,
|
INTEGER: 4,
|
||||||
@ -50,6 +51,8 @@ class CommandOption {
|
|||||||
this.minimum = typeof options.minimum === 'number' ? options.minimum : undefined; //Used for INTEGER/NUMBER/FLOAT types.
|
this.minimum = typeof options.minimum === 'number' ? options.minimum : undefined; //Used for INTEGER/NUMBER/FLOAT types.
|
||||||
this.maximum = typeof options.maximum === 'number' ? options.maximum : undefined;
|
this.maximum = typeof options.maximum === 'number' ? options.maximum : undefined;
|
||||||
|
|
||||||
|
this.flag = true; // used with message based command options
|
||||||
|
|
||||||
this.value = undefined;
|
this.value = undefined;
|
||||||
|
|
||||||
this._rawValue = options._rawValue ?? null; //Raw value input from Discord. -- use ?? where the value is potentially false, otherwise we end up with false -> null
|
this._rawValue = options._rawValue ?? null; //Raw value input from Discord. -- use ?? where the value is potentially false, otherwise we end up with false -> null
|
||||||
|
@ -2581,10 +2581,10 @@ minimist@^1.2.0:
|
|||||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
||||||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
||||||
|
|
||||||
moment@^2.29.2:
|
moment@^2.29.3:
|
||||||
version "2.29.2"
|
version "2.29.3"
|
||||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.2.tgz#00910c60b20843bcba52d37d58c628b47b1f20e4"
|
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.3.tgz#edd47411c322413999f7a5940d526de183c031f3"
|
||||||
integrity sha512-UgzG4rvxYpN15jgCmVJwac49h9ly9NurikMWGPdVxm8GZD6XjkKPxDTjQQ43gtGgnV3X0cAyWDdP2Wexoquifg==
|
integrity sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw==
|
||||||
|
|
||||||
mongodb-connection-string-url@^2.5.2:
|
mongodb-connection-string-url@^2.5.2:
|
||||||
version "2.5.2"
|
version "2.5.2"
|
||||||
|
Loading…
Reference in New Issue
Block a user