botrest

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: MIT Imports: 15 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

This section is empty.

Functions

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 *dstate.GuildSet, err error)

func GetMemberColors

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

func GetMemberMultiGuild

func GetMemberMultiGuild(userID int64, guilds ...int64) (members []*discordgo.Member, err error)

func GetMembers

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

func GetOnlineCount

func GetOnlineCount(guildID int64) (c int64, err error)

func GetSessionInfo

func GetSessionInfo(addr string) (st []*shardSessionInfo, err error)

func HandleBotMember

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

func HandleChannelPermissions

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

func HandleGetMemberColors

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

func HandleGetMembers

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

func HandleGetOnlineCount

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

func HandleGetShardSessions

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

func HandleGuild

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

func HandleNodeStatus

func HandleNodeStatus(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 RegisterPlugin

func RegisterPlugin()

func RestartAll

func RestartAll(reidentify bool)

func SendReconnectAll

func SendReconnectAll(reidentify bool) (err error)

func SendReconnectShard

func SendReconnectShard(shardID int, reidentify bool) (err error)

Types

type NodeStatus

type NodeStatus struct {
	ID     string         `json:"id"`
	Shards []*ShardStatus `json:"shards"`
	Host   string         `json:"host"`
	Uptime time.Duration  `json:"uptime"`
}

func GetNodeStatus

func GetNodeStatus(nodeID string) (*NodeStatus, error)

type NodeStatusesResponse

type NodeStatusesResponse struct {
	Nodes         []*NodeStatus `json:"nodes"`
	MissingShards []int         `json:"missing_shards"`
	TotalShards   int           `json:"total_shards"`
}

func GetNodeStatuses

func GetNodeStatuses() (st *NodeStatusesResponse, err error)

type Plugin

type Plugin struct {
}

func (*Plugin) InitInternalAPIRoutes

func (p *Plugin) InitInternalAPIRoutes(muxer *goji.Mux)

func (*Plugin) PluginInfo

func (p *Plugin) PluginInfo() *common.PluginInfo

type ReconnectResponse

type ReconnectResponse struct {
	SessionID        string `json:"session_id"`
	Sequence         int64  `json:"sequence"`
	ResumeGatewayUrl string `json:"resume_gateway_url"`
}

type ShardStatus

type ShardStatus struct {
	ShardID         int     `json:"shard_id"`
	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"`

	NumGuilds         int
	UnavailableGuilds int
}

Jump to

Keyboard shortcuts

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