diff --git a/discordplayer/interfaces/discordsessioninterface.go b/discordplayer/interfaces/discordsessioninterface.go index cd36870..8e58c50 100644 --- a/discordplayer/interfaces/discordsessioninterface.go +++ b/discordplayer/interfaces/discordsessioninterface.go @@ -25,13 +25,13 @@ func (dds *DefaultDiscordSession) ChannelVoiceJoin(gID string, cID string, mute } func (dds *DefaultDiscordSession) Guild(gID string) (guild DiscordGuild, err error) { - g, err := dds.session.Guild(gID) - - if err != nil { - return nil, err + for _, guild := range dds.session.State.Guilds { + if guild.ID == gID { + return NewDiscordGuild(guild), nil + } } - return NewDiscordGuild(g), err + return nil, nil } func (dds *DefaultDiscordSession) User(uID string) (user DiscordUser, err error) { diff --git a/discordplayer/voiceworker.go b/discordplayer/voiceworker.go index f958bd8..2c99407 100644 --- a/discordplayer/voiceworker.go +++ b/discordplayer/voiceworker.go @@ -318,6 +318,10 @@ func (dms *DiscordMusicSession) hasNonBotMembersInVoiceChannel(voiceChannelID st return false, err } + if guild == nil { + return false, errors.New("guild not found") + } + voiceStates := guild.GetVoiceStates() hasNonBotMembersInVC := false