Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &commands.YAGCommand{ Cooldown: 5, CmdCategory: commands.CategoryFun, Name: "TopServers", Description: "Responds with the top 15 servers I'm on", RunFunc: func(data *dcmd.Data) (interface{}, error) { state := bot.State state.RLock() guilds := make([]*discordgo.Guild, len(state.Guilds)) i := 0 for _, v := range state.Guilds { state.RUnlock() guilds[i] = v.LightCopy(true) state.RLock() i++ } state.RUnlock() sortable := GuildsSortUsers(guilds) sort.Sort(sortable) out := "```" for k, v := range sortable { if k > 14 { break } out += fmt.Sprintf("\n#%-2d: %-25s (%d members)", k+1, v.Name, v.MemberCount) } return "Top servers the bot is on (by membercount):\n" + out + "\n```", nil }, }
Functions ¶
This section is empty.
Types ¶
type GuildsSortUsers ¶
func (GuildsSortUsers) Len ¶
func (g GuildsSortUsers) Len() int
func (GuildsSortUsers) Less ¶
func (g GuildsSortUsers) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j.
func (GuildsSortUsers) Swap ¶
func (g GuildsSortUsers) Swap(i, j int)
Swap swaps the elements with indexes i and j.
Click to show internal directories.
Click to hide internal directories.