Documentation ¶
Index ¶
- Constants
- Variables
- func HandleGuildCreate(evt *eventsystem.EventData)
- func HandleMemberAdd(evt *eventsystem.EventData)
- func HandleMemberRemove(evt *eventsystem.EventData)
- func HandleMessageCreate(evt *eventsystem.EventData)
- func HandleSaveStatsSettings(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func HandleStatsCharts(w http.ResponseWriter, r *http.Request, isPublicAccess bool) interface{}
- func HandleStatsHtml(w http.ResponseWriter, r *http.Request, isPublicAccess bool) (web.TemplateData, error)
- func HandleStatsJson(w http.ResponseWriter, r *http.Request, isPublicAccess bool) interface{}
- func MarkGuildAsToBeChecked(guildID int64)
- func ProcessTempStats(full bool)
- func RedisKeyChannelMessages(guildID int64) string
- func RegisterPlugin()
- func RoundHour(t time.Time) time.Time
- func SetUpdateMemberStatsPeriod(guildID int64, memberIncr int, numMembers int)
- func UpdateGuildStats(guildID int64) error
- type CacheKey
- type ChannelStats
- type ChartResponse
- type DailyStats
- type FormData
- type MemberChartDataPeriod
- type MessageChartDataPeriod
- type Plugin
- type ServerStatsConfig
Constants ¶
View Source
const DBSchema = `` /* 1116-byte string literal not displayed */
View Source
const (
RedisKeyGuildMembersChanged = "servers_stats_guild_members_changed"
)
View Source
const (
RedisKeyLastHourlyRan = "serverstats_last_hourly_worker_ran"
)
Variables ¶
View Source
var WebStatsCache = rcache.New(cacheChartFetcher, time.Minute)
Functions ¶
func HandleGuildCreate ¶
func HandleGuildCreate(evt *eventsystem.EventData)
func HandleMemberAdd ¶
func HandleMemberAdd(evt *eventsystem.EventData)
func HandleMemberRemove ¶
func HandleMemberRemove(evt *eventsystem.EventData)
func HandleMessageCreate ¶
func HandleMessageCreate(evt *eventsystem.EventData)
func HandleSaveStatsSettings ¶ added in v1.4.1
func HandleSaveStatsSettings(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func HandleStatsCharts ¶ added in v1.16.0
func HandleStatsCharts(w http.ResponseWriter, r *http.Request, isPublicAccess bool) interface{}
func HandleStatsHtml ¶
func HandleStatsHtml(w http.ResponseWriter, r *http.Request, isPublicAccess bool) (web.TemplateData, error)
Somewhat dirty - should clean up this mess sometime
func HandleStatsJson ¶
func HandleStatsJson(w http.ResponseWriter, r *http.Request, isPublicAccess bool) interface{}
func MarkGuildAsToBeChecked ¶
func MarkGuildAsToBeChecked(guildID int64)
func ProcessTempStats ¶
func ProcessTempStats(full bool)
ProcessTempStats moves stats from redis to postgres batched up
func RedisKeyChannelMessages ¶ added in v1.16.0
func RegisterPlugin ¶
func RegisterPlugin()
func SetUpdateMemberStatsPeriod ¶ added in v1.16.0
func UpdateGuildStats ¶
Updates the stats on a specific guild, removing expired stats
Types ¶
type ChannelStats ¶
type ChartResponse ¶ added in v1.16.0
type ChartResponse struct { Days int `json:"days"` MemberData []*MemberChartDataPeriod `json:"member_chart_data"` MessageData []*MessageChartDataPeriod `json:"message_chart_data"` }
func CacheGetCharts ¶ added in v1.16.0
func CacheGetCharts(guildID int64, days int) *ChartResponse
type DailyStats ¶ added in v1.16.0
type DailyStats struct { ChannelMessages map[string]*ChannelStats `json:"channels_messages"` JoinedDay int `json:"joined_day"` LeftDay int `json:"left_day"` Online int `json:"online_now"` TotalMembers int `json:"total_members_now"` }
func RetrieveDailyStats ¶ added in v1.16.0
func RetrieveDailyStats(guildID int64) (*DailyStats, error)
func RetrieveRedisStats ¶
func RetrieveRedisStats(guildID int64) (*DailyStats, error)
type MemberChartDataPeriod ¶ added in v1.16.0
type MemberChartDataPeriod struct { T time.Time `json:"t"` Joins int `json:"joins"` Leaves int `json:"leaves"` NumMembers int `json:"num_members"` MaxOnline int `json:"max_online"` }
func RetrieveMemberChartStats ¶ added in v1.16.0
func RetrieveMemberChartStats(guildID int64, days int) ([]*MemberChartDataPeriod, error)
type MessageChartDataPeriod ¶ added in v1.16.0
type MessageChartDataPeriod struct { T time.Time `json:"t"` MessageCount int `json:"message_count"` }
func RetrieveMessageChartData ¶ added in v1.16.0
func RetrieveMessageChartData(guildID int64, days int) ([]*MessageChartDataPeriod, error)
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) AddCommands ¶ added in v1.4.1
func (p *Plugin) AddCommands()
func (*Plugin) RunBackgroundWorker ¶ added in v1.11.0
func (p *Plugin) RunBackgroundWorker()
func (*Plugin) RunCleanup ¶ added in v1.16.0
func (p *Plugin) RunCleanup()
func (*Plugin) StopBackgroundWorker ¶ added in v1.11.0
func (*Plugin) UpdateStatsLoop ¶ added in v1.11.0
func (p *Plugin) UpdateStatsLoop()
type ServerStatsConfig ¶
ServerStatsConfig represents a configuration for a server reason we dont reference the model directly is because i need to figure out a way to migrate them over to the new schema, painlessly.
func BotCachedFetchGuildConfig ¶ added in v1.7.4
func BotCachedFetchGuildConfig(ctx context.Context, gs *dstate.GuildState) (*ServerStatsConfig, error)
func (*ServerStatsConfig) ParseChannels ¶ added in v1.7.4
func (s *ServerStatsConfig) ParseChannels()
Click to show internal directories.
Click to hide internal directories.