Skip to content

Commit

Permalink
Allow setting member voice channel to nil
Browse files Browse the repository at this point in the history
  • Loading branch information
SinisterRectus committed Oct 1, 2020
1 parent a8e228f commit 24ce10f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions libs/containers/Member.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ with that guild. Note that any method or property that exists for the User class
also available in the Member class.
]=]

local json = require('json')
local enums = require('enums')
local class = require('class')
local UserPresence = require('containers/abstract/UserPresence')
Expand Down Expand Up @@ -356,13 +357,13 @@ handling, the member's `voiceChannel` property will update asynchronously via
WebSocket; not as a result of the HTTP request.
]=]
function Member:setVoiceChannel(id)
id = Resolver.channelId(id)
local data, err = self.client._api:modifyGuildMember(self._parent._id, self.id, {channel_id = id})
if data then
return true
else
return false, err
end
id = id and Resolver.channelId(id)
local data, err = self.client._api:modifyGuildMember(self._parent._id, self.id, {channel_id = id or json.null})
if data then
return true
else
return false, err
end
end

--[=[
Expand Down

0 comments on commit 24ce10f

Please sign in to comment.