go: discord/backend: Use RequestGuildMembers as suggested by the Gopher Discord server

master
Luther Wen Xu 2019-10-18 23:56:14 +07:00
parent ddf9af9557
commit 430b8be8f5
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
1 changed files with 4 additions and 0 deletions

@ -13,6 +13,10 @@ import (
var ErrMemberNotFound = errors.New("discord/backend: the requested member was not found") var ErrMemberNotFound = errors.New("discord/backend: the requested member was not found")
func GetAllMembers(s *discordgo.Session) ([]*discordgo.Member, error) { func GetAllMembers(s *discordgo.Session) ([]*discordgo.Member, error) {
err := s.RequestGuildMembers(config.GuildID, "", 0)
if err != nil {
return nil, err
}
guild, err := s.State.Guild(config.GuildID) guild, err := s.State.Guild(config.GuildID)
if err != nil { if err != nil {
guild, err = s.Guild(config.GuildID) guild, err = s.Guild(config.GuildID)