diff options
| author | rebecca <ubq323@ubq323.website> | 2026-09-13 14:55:10 +0100 |
|---|---|---|
| committer | rebecca <ubq323@ubq323.website> | 2026-09-13 14:55:10 +0100 |
| commit | dbb98dbb0233f8d9fd6a31849de4e297d838189a (patch) | |
| tree | 2c20dd91c59bf345e9a5cfda50a2031673a7da9b /discord/pylon.lua | |
| parent | af5285331ec224b14a3de9eda7e3db648603084b (diff) | |
add Log class
Diffstat (limited to 'discord/pylon.lua')
| -rw-r--r-- | discord/pylon.lua | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/discord/pylon.lua b/discord/pylon.lua index 180ec27..0e8c470 100644 --- a/discord/pylon.lua +++ b/discord/pylon.lua @@ -50,7 +50,7 @@ function Discord._connect(self) local me = self:_req"users/@me" self.bot_id = me.id - self.log('logged in as ',me) + self.log('logged in as ',me.username) for busname, bus in pairs(self.wilson.busses) do for _, channel in ipairs(bus) do @@ -65,15 +65,14 @@ function Discord.add_channel(self, channel) local webhooks = self:_req("channels/"..channel.descriptor.."/webhooks") for _,wh in pairs(webhooks) do if wh.application_id == self.bot_id then - -- self.log.debug("Found existing webhook for channel",channel.descriptor) + self.log("Found existing webhook for channel",channel.descriptor) self.channel_to_webhook[channel.descriptor] = wh return end end - print("Making webhook for channel "..channel.descriptor) + self.log("Making webhook for channel",channel.descriptor) local wh = self:_req_post("channels/"..channel.descriptor.."/webhooks", { name=self.name:gsub("discord",""):gsub("clyde","").." wilson hook" }) - pprint(wh) self.channel_to_webhook[channel.descriptor] = wh end @@ -92,9 +91,9 @@ end function Discord.recving(self) for packet in self.ws:each() do local event = json.decode(packet) - print(event.s, event.op, event.t) + self.log:debug(event.s, event.op, event.t) if event.op ~= opcodes.dispatch then - pprint(event.d) + self.log:debug(event.d) end if event.s then self.sequence_number = event.s end @@ -117,7 +116,7 @@ function Discord.handle_dispatch(self, event) sender = '[d]' .. d.author.username, }) elseif event.t == 'READY' then - pprint(event.d) + self.log:debug(event.d) end end |
