summaryrefslogtreecommitdiff
path: root/discord
diff options
context:
space:
mode:
authorrebecca <ubq323@ubq323.website>2026-09-13 16:25:56 +0100
committerrebecca <ubq323@ubq323.website>2026-09-13 16:25:56 +0100
commitc9b43b5bb9d85f68edded36428fb14f05debf190 (patch)
tree5c0c296c6b56fa66ceb874366e8b25e10e23baed /discord
parent57b7cec33e32f02fe67de91aec66662b6ae5c6ab (diff)
use log more pervasively, changes to discord and xmpp:
discord: fix some logic errors, correctly ignore messages in channels that we don't care about xmpp: reformat some of the recving logic, but it's still borken somehow, but olive says she wants to fix it not me
Diffstat (limited to 'discord')
-rw-r--r--discord/pylon.lua20
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,