botrest

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: MIT Imports: 21 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 Get added in v1.6.0

func Get(url string, dest interface{}) error

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 GetMemberColors added in v1.6.0

func GetMemberColors(guildID int64, members ...int64) (m map[string]int, err error)

func GetMembers

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

func GetOnlineCount added in v1.4.1

func GetOnlineCount(guildID int64) (c int64, 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 HandleGetMemberColors added in v1.6.0

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

func HandleGetMembers

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

func HandleGetOnlineCount added in v1.4.1

func HandleGetOnlineCount(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 Post added in v1.6.0

func Post(url string, bodyData interface{}, dest interface{}) error

func RegisterPlugin added in v1.4.1

func RegisterPlugin()

func RestartAll added in v1.4.1

func RestartAll(reidentify bool)

func RunPinger

func RunPinger()

func SendReconnectAll added in v1.4.1

func SendReconnectAll(reidentify bool) (err error)

func SendReconnectShard

func SendReconnectShard(shardID int, reidentify bool) (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

Types

type BotRestPlugin added in v1.6.0

type BotRestPlugin interface {
	InitBotRestServer(mux *goji.Mux)
}

type Plugin added in v1.4.1

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

func (*Plugin) BotInit added in v1.4.1

func (p *Plugin) BotInit()

func (*Plugin) Name added in v1.4.1

func (p *Plugin) Name() string

func (*Plugin) StopBot added in v1.4.1

func (p *Plugin) StopBot(wg *sync.WaitGroup)

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