Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 872 Bytes

File metadata and controls

42 lines (27 loc) · 872 Bytes

Go Reference

DList.top Go client

Official dlist.top gateway client for Go.

Installation

go get github.com/dlist-top/client-go

Setup

To get your token please refer to the DList.top documentation.

Example code

package main

import (
	"context"
	"log"

	dlist "github.com/dlist-top/client-go"
)

func main() {
	c := dlist.NewClient("YOUR_API_TOKEN")
	if err := c.Connect(context.Background()); err != nil {
		panic(err)
	}

	c.OnVote(func(data dlist.VoteData) {
		log.Printf("%v voted for our bot / server. Total: %v", data.UserID, data.TotalVotes)
	})

	<-make(chan bool)
}

Notice: You can have up to 2 connections (per token) at the same time.