calamity-0.1.26.0: A library for writing discord bots in haskell
Safe HaskellNone
LanguageHaskell2010

Calamity.Client

Contents

Description

Module containing the core client stuff

Synopsis

Documentation

Client stuff

This module provides the core components for running a discord client, along with abstractions for registering event handlers, firing custom events, and waiting on events.

Registered Metrics

  1. Counter: "events_recieved" [type, shard]

    Incremented for each event received, the type parameter is the type of event (the name of the constructor in DispatchData), and shard is the ID of the shard that received the event.

  1. Histogram: "cache_update"

    Tracks how long it takes to update the cache after recieving an event.

  2. Histogram: "event_handle"

    Tracks how long it takes to process an event handler for an event.

Examples

A simple client that prints every message recieved:

void . runFinal . embedToFinal . runCacheInMemory . runMetricsNoop $ runBotIO (BotToken token) $ do
  react @'MessageCreateEvt $ \msg -> embed $ print msg