blob: 5f1da981b237d6fc7f11583f1c0b811efb870ec5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import { type BushArgumentTypeCaster } 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);
if (content === null || content === undefined) return null;
content = content.trim();
const role = await util.arg.cast('role', message, content);
if (!role) return null;
return { duration, role };
};
export interface RoleWithDuration {
duration: number | null;
role: Role | null;
}
|