dizzy

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 19 Imported by: 0

README

dizzy

Dizzy is an implementation of a discord client library

Documentation

Overview

Package dizzy contains a implementation of a websocket client to discord

Index

Constants

This section is empty.

Variables

View Source
var ErrorNoACKAfterHeartbeat = fmt.Errorf("dizzy: did not receive an ACK after sending a heartbeat")

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apikey, endpoint string, intents primitives.GatewayIntent, eDist eDist, logger logging.Logger) *Client

func (*Client) AddHandlerFunc

func (c *Client) AddHandlerFunc(eventType primitives.GatewayEventType, handlerFunc func(event primitives.GatewayEvent)) error

func (*Client) Close

func (c *Client) Close() error

Close client and return if there was a error while closing

func (*Client) Open

func (c *Client) Open() error

Open Client and return if error while opening and/or setting up a session with Discord

type DeregisterFunction

type DeregisterFunction func()

DeregisterFunction is a function that is called to remove an EventHandler from the EventDistributor

type EventDistributor

type EventDistributor struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

EventDistributor for events

func NewEventDistributor

func NewEventDistributor() *EventDistributor

NewEventDistributor for events

func (*EventDistributor) FireEvent

func (e *EventDistributor) FireEvent(event primitives.GatewayEvent)

FireEvent to all listening EventHandler(s)

func (*EventDistributor) RegisterHandler

func (e *EventDistributor) RegisterHandler(eventType primitives.GatewayEventType, handler EventHandler) DeregisterFunction

RegisterHandler to be called when an Event is fired

func (*EventDistributor) RegisterHandlerOnce

func (e *EventDistributor) RegisterHandlerOnce(eventType primitives.GatewayEventType, handler EventHandler)

RegisterHandlerOnce lets an EventHandler be called and then removed after being called exactly once

func (*EventDistributor) WaitTilDone

func (e *EventDistributor) WaitTilDone()

WaitTilDone with all Events

type EventHandler

type EventHandler func(event primitives.GatewayEvent)

EventHandler function that is called on a event

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL