1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-27 09:12:53 +00:00

Voice: JoinChannel no longer takes in an extra GuildID

This commit is contained in:
diamondburned 2020-11-30 16:58:28 -08:00
parent 1463d6e675
commit 4df72dc891

View file

@ -150,9 +150,14 @@ func (v *Voice) RemoveSession(guildID discord.GuildID) {
}
// JoinChannel joins the specified channel in the specified guild.
func (v *Voice) JoinChannel(gID discord.GuildID, cID discord.ChannelID, muted, deafened bool) (*Session, error) {
func (v *Voice) JoinChannel(cID discord.ChannelID, muted, deafened bool) (*Session, error) {
c, err := v.Cabinet.Channel(cID)
if err != nil {
return nil, errors.Wrap(err, "failed to get channel from state")
}
// Get the stored voice session for the given guild.
conn, ok := v.GetSession(gID)
conn, ok := v.GetSession(c.GuildID)
// Create a new voice session if one does not exist.
if !ok {
@ -165,12 +170,12 @@ func (v *Voice) JoinChannel(gID discord.GuildID, cID discord.ChannelID, muted, d
conn.ErrorLog = v.ErrorLog
v.mapmutex.Lock()
v.sessions[gID] = conn
v.sessions[c.GuildID] = conn
v.mapmutex.Unlock()
}
// Connect.
return conn, conn.JoinChannel(gID, cID, muted, deafened)
return conn, conn.JoinChannel(c.GuildID, cID, muted, deafened)
}
func (v *Voice) Close() error {