mcabbot.lua
changeset 27 a166e9ab8065
parent 24 77a72b227d59
child 28 510849236c58
equal deleted inserted replaced
26:c12be727375b 27:a166e9ab8065
     8 require "mcbot.mcbot_engine"
     8 require "mcbot.mcbot_engine"
     9 
     9 
    10 local mcabbot = {}
    10 local mcabbot = {}
    11 mcabbot.nickname = "McBot"
    11 mcabbot.nickname = "McBot"
    12 mcabbot.jid = "mcabbot@lilotux.net"
    12 mcabbot.jid = "mcabbot@lilotux.net"
       
    13 mcabbot.cmdprefix = "%%"
    13 
    14 
    14 local function hk_subscription (h)
    15 local function hk_subscription (h)
    15     if h.type == "subscribe" then
    16     if h.type == "subscribe" then
    16         -- Let's authorize them...
    17         -- Let's authorize them...
    17         main.run("authorization allow "..h.jid)
    18         main.run("authorization allow "..h.jid)
    48             cmd = "say_to -q "..h.jid.." "..h.resource..": "
    49             cmd = "say_to -q "..h.jid.." "..h.resource..": "
    49         else
    50         else
    50             cmd = "say_to -q "..h.jid.."/"..h.resource.." "
    51             cmd = "say_to -q "..h.jid.."/"..h.resource.." "
    51         end
    52         end
    52         mcabbot.message = h
    53         mcabbot.message = h
    53         local res, errmsg = process(message, mcabbot, muc)
    54         local res, errmsg = process(message, mcabbot, muc, mcabbot.cmdprefix)
    54         mcabbot.message = nil
    55         mcabbot.message = nil
    55         if res then
    56         if res then
    56             msg = res
    57             msg = res
    57         elseif errmsg then
    58         elseif errmsg then
    58             msg = "! " .. errmsg
    59             msg = "! " .. errmsg