Skip to main content
Module

x/harmony/mod.ts>Collector

An easy to use Discord API Library for Deno.
Latest
class Collector
Re-export
import { Collector } from "https://deno.land/x/harmony@v2.9.0/mod.ts";

Constructors

new
Collector(options: CollectorOptions | string)

Type Parameters

optional
T extends unknown[] = any[]

Properties

private
_started: boolean
private
optional
_timer: number
optional
client: Client
collected: Collection<string, T>
deinitOnEnd: boolean
event: string
optional
max: number
started: boolean
optional
timeout: number

Methods

protected
check(..._args: T): boolean | Promise<boolean>

Checks we may want to perform on an extended version of Collector

_fire(...args: T): Promise<void>

Fire the Collector

collect(): this

Start collecting

deinit(client: Client): this

De initialize the Collector i.e. remove cleanly

each(handler: CallableFunction): this

Add a new listener for 'collect' event

end(): this

End collecting

init(client: Client): this

Init the Collector on Client

reset(): this

Reset collector and start again

wait(timeout?: number): Promise<this>

Returns a Promise resolved when Collector ends or a timeout occurs

when(filter: CollectorFilter): this

Set filter of the Collector

Constructors

new
Collector(options: CollectorOptions | string)

Type Parameters

optional
T extends unknown[] = any[]

Properties

private
_started: boolean
private
optional
_timer: number
optional
client: Client
collected: Collection<string, T>
deinitOnEnd: boolean
event: string
optional
max: number
started: boolean
optional
timeout: number

Methods

protected
check(..._args: T): boolean | Promise<boolean>

Checks we may want to perform on an extended version of Collector

_fire(...args: T): Promise<void>

Fire the Collector

collect(): this

Start collecting

deinit(client: Client): this

De initialize the Collector i.e. remove cleanly

each(handler: CallableFunction): this

Add a new listener for 'collect' event

end(): this

End collecting

init(client: Client): this

Init the Collector on Client

reset(): this

Reset collector and start again

wait(timeout?: number): Promise<this>

Returns a Promise resolved when Collector ends or a timeout occurs

when(filter: CollectorFilter): this

Set filter of the Collector