diff options
| -rw-r--r-- | discord/pylon.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/discord/pylon.lua b/discord/pylon.lua index 1eb0a5a..3281c53 100644 --- a/discord/pylon.lua +++ b/discord/pylon.lua @@ -36,6 +36,7 @@ function Discord._req(self, url, payload) local status = head:get':status' local bod = body:get_body_as_string() assert(status:match"^2", 'status was '..status..' body '..bod) + if #bod == 0 then return nil end local val, _, err = json.decode(bod) if err then error(err) else return val end end @@ -127,7 +128,7 @@ function Discord.sending(self) for dest_channel, message in self.inbox:iter() do self.log:proto('>',dest_channel,message.sender,message.body) local wh = self.channel_to_webhook[dest_channel.descriptor] - self._req('webhooks/'..wh.id..'/'..wh.token, { + self:_req('webhooks/'..wh.id..'/'..wh.token, { username = message.sender, content = message.body, }) |
