Skip to content

Commit

Permalink
direct message stub
Browse files Browse the repository at this point in the history
  • Loading branch information
NatureFreshMilk committed Jan 24, 2020
1 parent 916c0f8 commit 788879c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions web/rx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ local http = beerchat.http
local recv_loop

function handle_data(data)
if not data or not data.username or not data.channel
or not data.message or not data.name then
if not data or not data.username or not data.message or not data.name then
return
end

-- TODO: "direct" / pm / system-exec message
local name = data.username .. "@" .. data.name
beerchat.send_on_channel(name, data.channel, data.message)

if data.channel and data.channel ~= "" then
-- channel message
beerchat.send_on_channel(name, data.channel, data.message)

elseif data.direct then
-- direct message
beerchat.executor(data.message, name)

-- TODO: return value
end
end


Expand Down

0 comments on commit 788879c

Please sign in to comment.