Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Throttle

Hierarchy

  • Throttle

Index

Properties

Private initial

initial: number = 1

Private penalty

penalty: number = 1

Private restore

restore: number = 1

Private throttled

throttled: Record<string, ThrottleInterface>

Private tickrate

tickrate: number = 1000

Methods

Private createIdIfNotExists

initialPoints

  • initialPoints(initial: number): this
  • Sets the initial Points a user has at beginning

    Parameters

    • initial: number

      the Initial amount of Points a user has

    Returns this

isThrottled

  • isThrottled(client: TeamSpeakClient): boolean
  • Checks if the given Client is affected by throttle limitations

    Parameters

    • client: TeamSpeakClient

      the TeamSpeak Client which should get checked

    Returns boolean

penaltyPerCommand

  • penaltyPerCommand(amount: number): this
  • The amount of points a command request costs

    Parameters

    • amount: number

      the amount of points that should be reduduced

    Returns this

Private reducePoints

  • reducePoints(id: string): void
  • Removes points from an id

    Parameters

    • id: string

      the identifier which should be added

    Returns void

Private refreshTimeout

  • refreshTimeout(id: string): void
  • Resets the timeout counter for a stored id

    Parameters

    • id: string

      the identifier which should be added

    Returns void

restorePerTick

  • restorePerTick(amount: number): this
  • The Amount of Points that should get restored per tick

    Parameters

    • amount: number

      the amount that should get restored

    Returns this

Private restorePoints

  • restorePoints(id: string): void
  • Restores points from the given id

    Parameters

    • id: string

      the identifier for which the points should be stored

    Returns void

stop

  • stop(): this

throttle

  • throttle(client: TeamSpeakClient): boolean
  • Reduces the given points for a Command for the given Client

    Parameters

    • client: TeamSpeakClient

      the client which points should be removed

    Returns boolean

tickRate

  • tickRate(duration: number): this
  • Defines how fast points will get restored

    Parameters

    • duration: number

      time in ms how fast points should get restored

    Returns this

timeTillNextCommand

  • timeTillNextCommand(client: TeamSpeakClient): number
  • retrieves the time in milliseconds until a client can send his next command

    Parameters

    • client: TeamSpeakClient

      the client which should be checked

    Returns number

    returns the time a client is throttled in ms

Generated using TypeDoc