Merge branch 'timeRelatedTagArgs' of git://github.com/DarkView/ZeppelinBot into DarkView-timeRelatedTagArgs
This commit is contained in:
commit
d4f954240d
1 changed files with 33 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
import { decorators as d, IPluginOptions, logger } from "knub";
|
||||
import { Member, Message, TextChannel } from "eris";
|
||||
import { errorMessage, successMessage, stripObjectToScalars, tNullable } from "../utils";
|
||||
import { errorMessage, successMessage, stripObjectToScalars, tNullable, convertDelayStringToMS } from "../utils";
|
||||
import { GuildTags } from "../data/GuildTags";
|
||||
import { GuildSavedMessages } from "../data/GuildSavedMessages";
|
||||
import { SavedMessage } from "../data/entities/SavedMessage";
|
||||
|
@ -101,8 +101,39 @@ export class TagsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
return diff >= 0 ? result : `${result} ago`;
|
||||
},
|
||||
|
||||
today() {
|
||||
return moment();
|
||||
},
|
||||
|
||||
timeXAgo(timeDiff) {
|
||||
if (typeof timeDiff !== "string") {
|
||||
return 'Please pass a valid delay as a string to timeXAgo (e.g. timeXAgo("1w"))';
|
||||
}
|
||||
|
||||
const delay = convertDelayStringToMS(timeDiff);
|
||||
return moment(moment().valueOf() - delay).valueOf();
|
||||
},
|
||||
|
||||
humanizeTime(timems) {
|
||||
if (typeof timems !== "number") {
|
||||
return moment().format("DD-MM-YYYY HH:mm");
|
||||
}
|
||||
|
||||
return moment(timems).format("DD-MM-YYYY HH:mm");
|
||||
},
|
||||
|
||||
discordDateFormat(timems) {
|
||||
if (typeof timems !== "number") {
|
||||
return moment().format("YYYY-MM-DD");
|
||||
}
|
||||
|
||||
return moment(timems).format("YYYY-MM-DD");
|
||||
},
|
||||
|
||||
mention: input => {
|
||||
if (typeof input !== "string") return "";
|
||||
if (typeof input !== "string") {
|
||||
return "";
|
||||
}
|
||||
if (input.match(/^<(@#)(!&)\d+>$/)) {
|
||||
return input;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue