Permalink
Browse files

Delay carbonitex as startup can be slow. Show how many shards are con…

…nected in info.
  • Loading branch information...
1 parent 90922a0 commit 5aab792bb5293e739c3886a7c0b169ab4ed11f32 @iopred committed Sep 17, 2016
Showing with 8 additions and 2 deletions.
  1. +1 −1 carbonitexplugin/carbonitexplugin.go
  2. +7 −1 statsplugin/statsplugin.go
@@ -25,7 +25,7 @@ func (p *carbonitexPlugin) carbonitexPluginLoadFunc(bot *bruxism.Bot, service br
func (p *carbonitexPlugin) Run(bot *bruxism.Bot, service bruxism.Service) {
for {
- <-time.After(30 * time.Second)
+ <-time.After(5 * time.Minute)
http.PostForm("https://www.carbonitex.net/discord/data/botdata.php", url.Values{"key": {p.key}, "servercount": {fmt.Sprintf("%d", service.ChannelCount())}})
@@ -47,7 +47,13 @@ func StatsCommand(bot *bruxism.Bot, service bruxism.Service, message bruxism.Mes
if service.Name() == bruxism.DiscordServiceName {
discord := service.(*bruxism.Discord)
fmt.Fprintf(w, "Connected servers: \t%d\n", service.ChannelCount())
- fmt.Fprintf(w, "Shards: \t%d\n", len(discord.Sessions))
+ shards := 0
+ for _, s := range discord.Sessions {
+ if s.DataReady {
+ shards++
+ }
+ }
+ fmt.Fprintf(w, "Shards: \t%d/%d\n", shards, len(discord.Sessions))
fmt.Fprintf(w, "\n```")
} else {
fmt.Fprintf(w, "Connected channels: \t%d\n", service.ChannelCount())

0 comments on commit 5aab792

Please sign in to comment.