Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit 6ad5688

Browse files
author
jonas747
committed
added GuildWithCounts
1 parent 0e1ba11 commit 6ad5688

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

restapi.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,18 @@ func (s *Session) Guild(guildID int64) (st *Guild, err error) {
680680
return
681681
}
682682

683+
// Guild returns a Guild structure of a specific Guild.
684+
// guildID : The ID of a Guild
685+
func (s *Session) GuildWithCounts(guildID int64) (st *Guild, err error) {
686+
body, err := s.RequestWithBucketID("GET", EndpointGuild(guildID)+"?with_counts=true", nil, EndpointGuild(guildID))
687+
if err != nil {
688+
return
689+
}
690+
691+
err = unmarshal(body, &st)
692+
return
693+
}
694+
683695
// GuildCreate creates a new Guild
684696
// name : A name for the Guild (2-100 characters)
685697
func (s *Session) GuildCreate(name string) (st *Guild, err error) {

structs.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ type Guild struct {
437437

438438
// The Channel ID to which system messages are sent (eg join and leave messages)
439439
SystemChannelID string `json:"system_channel_id"`
440+
441+
ApproximateMemberCount int `json:"approximate_member_count"`
442+
ApproximatePresenceCount int `json:"approximate_presence_count"`
440443
}
441444

442445
func (g *Guild) GetGuildID() int64 {

0 commit comments

Comments
 (0)