bwmarrin / discordgo

(Golang) Go bindings for Discord
BSD 3-Clause "New" or "Revised" License
5.12k stars 817 forks source link

Unable to get the Guild members #1277

Open Sandeep-Narahari opened 2 years ago

Sandeep-Narahari commented 2 years ago
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
    g, err := s.State.Guild(m.guildID)
    if err != nil {
        fmt.Println(err.Error())

    }
    fmt.Println(g.Members)
}

Not at all getting guildmembers as when I am trying to get guild member count then it shows 0 as output , May I know how do I use guildMembers

Thank you

Nv7-GitHub commented 2 years ago

Make sure you have the guild members intent in your code and the priveleged intent in the dashboard

elliotwms commented 1 year ago

As @Nv7-GitHub stated above, List Guild Members is a privileged intent. See my other answer here for more info