diff options
Diffstat (limited to 'discord')
| -rw-r--r-- | discord/pylon.lua | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/discord/pylon.lua b/discord/pylon.lua index 0583e6b..fa2638d 100644 --- a/discord/pylon.lua +++ b/discord/pylon.lua @@ -2,7 +2,6 @@ local cqueues = require 'cqueues' local websocket = require'http.websocket' local request = require'http.request' local json = require 'dkjson' -local pprint = require 'pprint' local class = require 'r.class' local BasePylon = require 'pylon' @@ -109,12 +108,17 @@ end function Discord.handle_dispatch(self, event) local d = event.d if event.t == 'MESSAGE_CREATE' then - if d.author.id == self.channel_to_webhook[d.channel_id].id then return end - if d.author.id == self.bot_id then return end - self.wilson:deliver(Channel(self, d.channel_id), { - body = d.content, - sender = '[d]' .. d.author.username, - }) + self.log:proto('<',d.channel_id,d.author.username,d.content) + if + self.channel_to_webhook[d.channel_id] + and d.author.id ~= self.channel_to_webhook[d.channel_id].id + and d.author.id ~= self.bot_id + then + self.wilson:deliver(Channel(self, d.channel_id), { + body = d.content, + sender = '[d]' .. d.author.username, + }) + end elseif event.t == 'READY' then self.log:debug(event.d) end @@ -122,7 +126,7 @@ end function Discord.sending(self) for dest_channel, message in self.inbox:iter() do - print('DDD',dest_channel,message.sender,message.body) + self.log:proto('>',dest_channel,message.sender,message.body) exec_webhook(self.channel_to_webhook[dest_channel.descriptor].url, { username = message.sender, content = message.body, |
