mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-17 16:23:58 +00:00
fix(bots/discord/commands/mute): use existing parseDuration util function'
This commit is contained in:
@@ -6,7 +6,7 @@ import type { Command } from '..'
|
|||||||
|
|
||||||
import { config } from '$/context'
|
import { config } from '$/context'
|
||||||
import { applyReferenceToModerationActionEmbed, createModerationActionEmbed } from '$/utils/discord/embeds'
|
import { applyReferenceToModerationActionEmbed, createModerationActionEmbed } from '$/utils/discord/embeds'
|
||||||
import { parse } from 'simple-duration'
|
import { parseDuration } from '$/utils/duration'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -27,7 +27,7 @@ export default {
|
|||||||
const user = interaction.options.getUser('member', true)
|
const user = interaction.options.getUser('member', true)
|
||||||
const reason = interaction.options.getString('reason')
|
const reason = interaction.options.getString('reason')
|
||||||
const duration = interaction.options.getString('duration')
|
const duration = interaction.options.getString('duration')
|
||||||
const durationMs = duration ? parse(duration) : null
|
const durationMs = duration ? parseDuration(duration) : null
|
||||||
|
|
||||||
if (Number.isInteger(durationMs) && durationMs! < 1)
|
if (Number.isInteger(durationMs) && durationMs! < 1)
|
||||||
throw new CommandError(
|
throw new CommandError(
|
||||||
|
|||||||
5
bots/discord/src/types.d.ts
vendored
5
bots/discord/src/types.d.ts
vendored
@@ -3,8 +3,3 @@ type IfTrue<Condition, True, False> = IfExtends<Condition, true, True, False>
|
|||||||
type EmptyObject<K = PropertyKey> = Record<K, never>
|
type EmptyObject<K = PropertyKey> = Record<K, never>
|
||||||
type ValuesOf<T> = T[keyof T]
|
type ValuesOf<T> = T[keyof T]
|
||||||
type MaybeArray<T> = T | T[]
|
type MaybeArray<T> = T | T[]
|
||||||
|
|
||||||
declare module 'simple-duration' {
|
|
||||||
export function parse(duration: string): number
|
|
||||||
export function stringify(duration: number): string
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user