aboutsummaryrefslogtreecommitdiff
path: root/src/arguments
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-16 14:32:18 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-16 14:32:18 -0400
commit0e87bbd3940d89defcb04926587b35c8f4d1947f (patch)
treee50860d4dc25a11d4c3977b583284c4bcad1b077 /src/arguments
parent661e4c9935aeb8760dafc7ced4bbec6cc356a033 (diff)
downloadtanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.gz
tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.bz2
tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.zip
remove util classes, move config out of src
Diffstat (limited to 'src/arguments')
-rw-r--r--src/arguments/contentWithDuration.ts4
-rw-r--r--src/arguments/discordEmoji.ts4
-rw-r--r--src/arguments/duration.ts4
-rw-r--r--src/arguments/durationSeconds.ts4
-rw-r--r--src/arguments/messageLink.ts4
-rw-r--r--src/arguments/roleWithDuration.ts6
-rw-r--r--src/arguments/snowflake.ts4
7 files changed, 15 insertions, 15 deletions
diff --git a/src/arguments/contentWithDuration.ts b/src/arguments/contentWithDuration.ts
index e92997a..0efba39 100644
--- a/src/arguments/contentWithDuration.ts
+++ b/src/arguments/contentWithDuration.ts
@@ -1,5 +1,5 @@
-import type { BushArgumentTypeCaster, ParsedDuration } from '#lib';
+import { parseDuration, type BushArgumentTypeCaster, type ParsedDuration } from '#lib';
export const contentWithDuration: BushArgumentTypeCaster<Promise<ParsedDuration>> = async (_, phrase) => {
- return client.util.parseDuration(phrase);
+ return parseDuration(phrase);
};
diff --git a/src/arguments/discordEmoji.ts b/src/arguments/discordEmoji.ts
index 57710e4..92d6502 100644
--- a/src/arguments/discordEmoji.ts
+++ b/src/arguments/discordEmoji.ts
@@ -1,9 +1,9 @@
-import type { BushArgumentTypeCaster } from '#lib';
+import { regex, type BushArgumentTypeCaster } from '#lib';
import type { Snowflake } from 'discord.js';
export const discordEmoji: BushArgumentTypeCaster<DiscordEmojiInfo | null> = (_, phrase) => {
if (!phrase) return null;
- const validEmoji: RegExpExecArray | null = client.consts.regex.discordEmoji.exec(phrase);
+ const validEmoji: RegExpExecArray | null = regex.discordEmoji.exec(phrase);
if (!validEmoji || !validEmoji.groups) return null;
return { name: validEmoji.groups.name, id: validEmoji.groups.id };
};
diff --git a/src/arguments/duration.ts b/src/arguments/duration.ts
index ffd9159..09dd3d5 100644
--- a/src/arguments/duration.ts
+++ b/src/arguments/duration.ts
@@ -1,5 +1,5 @@
-import type { BushArgumentTypeCaster } from '#lib';
+import { parseDuration, type BushArgumentTypeCaster } from '#lib';
export const duration: BushArgumentTypeCaster<number | null> = (_, phrase) => {
- return client.util.parseDuration(phrase).duration;
+ return parseDuration(phrase).duration;
};
diff --git a/src/arguments/durationSeconds.ts b/src/arguments/durationSeconds.ts
index 432fd8c..d8d6749 100644
--- a/src/arguments/durationSeconds.ts
+++ b/src/arguments/durationSeconds.ts
@@ -1,6 +1,6 @@
-import type { BushArgumentTypeCaster } from '#lib';
+import { parseDuration, type BushArgumentTypeCaster } from '#lib';
export const durationSeconds: BushArgumentTypeCaster<number | null> = (_, phrase) => {
phrase += 's';
- return client.util.parseDuration(phrase).duration;
+ return parseDuration(phrase).duration;
};
diff --git a/src/arguments/messageLink.ts b/src/arguments/messageLink.ts
index 457410e..a473485 100644
--- a/src/arguments/messageLink.ts
+++ b/src/arguments/messageLink.ts
@@ -1,8 +1,8 @@
-import type { BushArgumentTypeCaster } from '#lib';
+import { BushArgumentTypeCaster, regex } from '#lib';
import type { Message } from 'discord.js';
export const messageLink: BushArgumentTypeCaster<Promise<Message | null>> = async (_, phrase) => {
- const match = new RegExp(client.consts.regex.messageLink).exec(phrase);
+ const match = new RegExp(regex.messageLink).exec(phrase);
if (!match || !match.groups) return null;
const { guild_id, channel_id, message_id } = match.groups;
diff --git a/src/arguments/roleWithDuration.ts b/src/arguments/roleWithDuration.ts
index e338b79..b97f205 100644
--- a/src/arguments/roleWithDuration.ts
+++ b/src/arguments/roleWithDuration.ts
@@ -1,12 +1,12 @@
-import type { BushArgumentTypeCaster } from '#lib';
+import { Arg, BushArgumentTypeCaster, parseDuration } from '#lib';
import type { Role } from 'discord.js';
export const roleWithDuration: BushArgumentTypeCaster<Promise<RoleWithDuration | null>> = async (message, phrase) => {
// eslint-disable-next-line prefer-const
- let { duration, content } = client.util.parseDuration(phrase);
+ let { duration, content } = parseDuration(phrase);
if (content === null || content === undefined) return null;
content = content.trim();
- const role = await util.arg.cast('role', message, content);
+ const role = await Arg.cast('role', message, content);
if (!role) return null;
return { duration, role };
};
diff --git a/src/arguments/snowflake.ts b/src/arguments/snowflake.ts
index dc83909..b98a20f 100644
--- a/src/arguments/snowflake.ts
+++ b/src/arguments/snowflake.ts
@@ -1,8 +1,8 @@
-import type { BushArgumentTypeCaster } from '#lib';
+import { BushArgumentTypeCaster, regex } from '#lib';
import type { Snowflake } from 'discord.js';
export const snowflake: BushArgumentTypeCaster<Snowflake | null> = (_, phrase) => {
if (!phrase) return null;
- if (client.consts.regex.snowflake.test(phrase)) return phrase;
+ if (regex.snowflake.test(phrase)) return phrase;
return null;
};