botrest

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: MIT Imports: 18 Imported by: 0

README

Provides access to bot state using a rest api to be accessed from e.g scripts or the webserver

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerError = errors.New("reststate server is having issues")
)

Functions

func BotIsRunning

func BotIsRunning() bool

Returns wether the bot is running or not, (time since last sucessfull ping was less than 5 seconds)

func GetBotMember

func GetBotMember(guildID int64) (m *discordgo.Member, err error)

func GetChannelPermissions

func GetChannelPermissions(guildID, channelID int64) (perms int64, err error)

func GetGuild

func GetGuild(guildID int64) (g *discordgo.Guild, err error)

func GetMembers

func GetMembers(guildID int64, members ...int64) (m []*discordgo.Member, err error)

func HandleBotMember

func HandleBotMember(w http.ResponseWriter, r *http.Request)

func HandleChannelPermissions

func HandleChannelPermissions(w http.ResponseWriter, r *http.Request)

func HandleGWStatus

func HandleGWStatus(w http.ResponseWriter, r *http.Request)

func HandleGetMembers

func HandleGetMembers(w http.ResponseWriter, r *http.Request)

func HandleGuild

func HandleGuild(w http.ResponseWriter, r *http.Request)

func HandlePing

func HandlePing(w http.ResponseWriter, r *http.Request)

func HandleReconnectShard

func HandleReconnectShard(w http.ResponseWriter, r *http.Request)

func RunPinger

func RunPinger()

func SendReconnectShard

func SendReconnectShard(shardID int) (err error)

func ServeJson

func ServeJson(w http.ResponseWriter, r *http.Request, data interface{})

func ServerError

func ServerError(w http.ResponseWriter, r *http.Request, err error) bool

Returns true if an error occured

func StartServer

func StartServer()

Types

type ShardStatus

type ShardStatus struct {
	TotalEvents     int64   `json:"total_events"`
	EventsPerSecond float64 `json:"events_per_second"`

	ConnStatus discordgo.GatewayStatus `json:"conn_status"`

	LastHeartbeatSend time.Time `json:"last_heartbeat_send"`
	LastHeartbeatAck  time.Time `json:"last_heartbeat_ack"`
}

func GetShardStatuses

func GetShardStatuses() (st []*ShardStatus, err error)

Jump to

Keyboard shortcuts

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