Options
All
  • Public
  • Public/Protected
  • All
Menu

Stats stores and prints statistics.

The bot logs statistics each ~10s (if they changed):

  stat info [12:34:56] rx:32 tx:16 | allow/deny:5/0 typing:3 new:7(start:2 action:1) edit:1 | reply:16 | no_match:0 err:0

General statistics

Statistics Description
[...] Process uptime (hh:mm:ss)
rx Amount of received events from Callback API
tx Amount of sent messages

Callback API event statistics

Statistics Description
new message_new events
allow message_allow events
deny message_deny events
edit message_edit events
reply message_reply events
typing message_typing_state events

Other event statistics

Statistics Description
start start events
action service_action events
no_match no_match events
err handler_error events

Hierarchy

  • Stats

Index

Constructors

Properties

Methods

Object literals

Constructors

constructor

Properties

previous

previous: string = ""

Previous stats log message, without time

rx

rx: number = 0

Count of requests from the Callback API.

tx

tx: number = 0

Count of messages sent.

Methods

event

  • event(eventName: string): void
  • This is used to tell Stats that an event was emitted.

    Parameters

    • eventName: string

    Returns void

Private formatDuration

  • formatDuration(totalSeconds: number): string
  • Formats seconds into hh:mm:ss (hh may use more than two digits for very large durations).

    Parameters

    • totalSeconds: number

    Returns string

Private getEventCount

  • getEventCount(eventName: string): string
  • Returns how much events of this type were emitted.

    Parameters

    • eventName: string

    Returns string

Private print

  • print(): void

sent

  • sent(): void
  • This is used to tell Stats that a message was sent.

    Returns void

Object literals

eventCounters

eventCounters: object

Count of various events.

handler_error

handler_error: number = 0

message_allow

message_allow: number = 0

message_deny

message_deny: number = 0

message_edit

message_edit: number = 0

message_new

message_new: number = 0

message_reply

message_reply: number = 0

message_typing_state

message_typing_state: number = 0

no_match

no_match: number = 0

service_action

service_action: number = 0

start

start: number = 0

Generated using TypeDoc