fakediscord

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package fakediscord provides an in-memory implementation of the Discord API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationDevInfo

type ApplicationDevInfo struct {
	ID       string
	BotToken string
}

ApplicationDevInfo represents the information a Discord developer obtains from the developer portal.

type Server

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

A Server is an isolated instance of the Discord API. It implements http.Handler and serves at the path "/api". It is safe to call Server's methods from multiple goroutines. The zero value is an instance of the Discord API without any users or channels.

func (*Server) RegisterBot

func (srv *Server) RegisterBot(username string) *ApplicationDevInfo

RegisterBot creates a new application and bot user.

func (*Server) RegisterUser

func (srv *Server) RegisterUser(username string) (bearerToken string)

RegisterUser creates a new end-user account.

func (*Server) ServeHTTP

func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves an API request.

func (*Server) SetLogger

func (srv *Server) SetLogger(logger log.Logger)

SetLogger sets the log that the server writes events to. The default is to discard logs.

Jump to

Keyboard shortcuts

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