aboutsummaryrefslogtreecommitdiff
path: root/src/arguments
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-30 19:38:16 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-30 19:38:16 -0400
commit70fac30661ee06b07baceed6e44880b16e244626 (patch)
tree44b4c573043fc369ba9c79ef368da2f08f34e442 /src/arguments
parentf5c2b7b946487c2828365cc63bc6f471dd6cfc2f (diff)
downloadtanzanite-70fac30661ee06b07baceed6e44880b16e244626.tar.gz
tanzanite-70fac30661ee06b07baceed6e44880b16e244626.tar.bz2
tanzanite-70fac30661ee06b07baceed6e44880b16e244626.zip
general clean up and fix automod
Diffstat (limited to 'src/arguments')
-rw-r--r--src/arguments/duration.ts13
-rw-r--r--src/arguments/permission.ts12
2 files changed, 12 insertions, 13 deletions
diff --git a/src/arguments/duration.ts b/src/arguments/duration.ts
index 53b200e..ce181e8 100644
--- a/src/arguments/duration.ts
+++ b/src/arguments/duration.ts
@@ -1,18 +1,5 @@
import { BushArgumentTypeCaster, BushMessage } from '@lib';
export const durationTypeCaster: BushArgumentTypeCaster = (_message: BushMessage, phrase): number => {
- // if (!phrase) return null;
- // const regexString = Object.entries(BushConstants.TimeUnits)
- // .map(([name, { label }]) => String.raw`(?:(?<${name}>-?(?:\d+)?\.?\d+) *${label})?`)
- // .join('\\s*');
- // const match = new RegExp(`^${regexString}$`, 'im').exec(phrase);
- // if (!match) return null;
- // let milliseconds = 0;
- // for (const key in match.groups) {
- // const value = Number(match.groups[key] || 0);
- // milliseconds += value * BushConstants.TimeUnits[key].value;
- // }
- // return milliseconds;
-
return client.util.parseDuration(phrase).duration;
};
diff --git a/src/arguments/permission.ts b/src/arguments/permission.ts
new file mode 100644
index 0000000..dc90f3a
--- /dev/null
+++ b/src/arguments/permission.ts
@@ -0,0 +1,12 @@
+import { Permissions } from 'discord.js';
+import { BushArgumentTypeCaster } from '../lib/extensions/discord-akairo/BushArgumentTypeCaster';
+
+export const permissionTypeCaster: BushArgumentTypeCaster = (_, phrase) => {
+ if (!phrase) return null;
+ phrase = phrase.toUpperCase().replace(/ /g, '_');
+ if (!Permissions.FLAGS[phrase]) {
+ return null;
+ } else {
+ return phrase;
+ }
+};