mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
tags: validate input types for timeAdd and timeSub
This commit is contained in:
parent
7edfe1581a
commit
c84d1a0be1
1 changed files with 20 additions and 0 deletions
|
@ -133,6 +133,10 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()({
|
||||||
return Date.now();
|
return Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Number.isNaN(Number(str))) {
|
||||||
|
return Number(str); // Unix timestamp as a string
|
||||||
|
}
|
||||||
|
|
||||||
return moment.tz(str, "YYYY-MM-DD HH:mm:ss", tz).valueOf();
|
return moment.tz(str, "YYYY-MM-DD HH:mm:ss", tz).valueOf();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -156,6 +160,14 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()({
|
||||||
let reference;
|
let reference;
|
||||||
let delay;
|
let delay;
|
||||||
|
|
||||||
|
for (const [i, arg] of args.entries()) {
|
||||||
|
if (typeof arg === "number") {
|
||||||
|
args[i] = String(arg);
|
||||||
|
} else if (typeof arg !== "string") {
|
||||||
|
args[i] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (args.length >= 2) {
|
if (args.length >= 2) {
|
||||||
// (time, delay)
|
// (time, delay)
|
||||||
reference = this.parseDateTime(args[0]);
|
reference = this.parseDateTime(args[0]);
|
||||||
|
@ -175,6 +187,14 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()({
|
||||||
let reference;
|
let reference;
|
||||||
let delay;
|
let delay;
|
||||||
|
|
||||||
|
for (const [i, arg] of args.entries()) {
|
||||||
|
if (typeof arg === "number") {
|
||||||
|
args[i] = String(arg);
|
||||||
|
} else if (typeof arg !== "string") {
|
||||||
|
args[i] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (args.length >= 2) {
|
if (args.length >= 2) {
|
||||||
// (time, delay)
|
// (time, delay)
|
||||||
reference = this.parseDateTime(args[0]);
|
reference = this.parseDateTime(args[0]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue