Posted 10 October 2012 - 02:23 PM
The code:
Code is from marticnobot, tho it is slightly modified by me
The problem: is_cmd is allways tru, therefor my bot allways tryes to run command, even when i don't use the **prefix.
Example:
say (text) would make him say respond (text)
I want it to only trigger when ** is used infront of command, but idk how to edit the message:match line to do so.
If you could tell me how i would be so thankful
code:
Code is from marticnobot, tho it is slightly modified by me
The problem: is_cmd is allways tru, therefor my bot allways tryes to run command, even when i don't use the **prefix.
Example:
say (text) would make him say respond (text)
I want it to only trigger when ** is used infront of command, but idk how to edit the message:match line to do so.
If you could tell me how i would be so thankful
code:
irc.register_callback("channel_msg", function(channel, from, message)
--local bleh = string.lower(message)
--if string.find(bleh, "hi") or string.find(bleh, "ey") or string.find(bleh, "hey") or string.find(bleh, "hello") then
--irc.say(channel, "Hi "..from)
--return
--end
if from == "HBot" and string.find(message, "SjBaot: Please lower your caps usage.") then
irc.say(channel, "I love you too HBot")
return
end
if from == "Sjele" and string.find(string.lower(message),"lock you sjbaot") then
if lock == nil then
lock = true
irc.say(channel, "State has been changed")
return
end
irc.say(channel, "Locked status altred")
lock = not lock
end
local is_cmd, cmd, arg = message:match("(**)(%w+) (.*)$")
if is_cmd and plugin[cmd] then
if lock == true then
if from ~="Sjele" then
irc.say(channel, "Baot is locked")
return
end
end
plugin[cmd](channel.name, from, arg)
end
for k,v in pairs(callback) do
if type(v) == "function" then
v(channel.name, from, message)
end
end
--end
--end
end)