Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local name = "moo.lua"
- local desc = "mooooooooooooooo"
- local version = "0.2"
- function xchat_register()
- return name, desc, version
- end
- function process_crackbot(word)
- if word[1]==":Crackbot!~Meow@unaffiliated/jacob1/bot/jacobot" and word[2]=="PRIVMSG" and word[3]=="^v" and word[4]==":-^v:" then
- local txt=table.concat({unpack(word,5)}," ")
- if txt:match("%(%+(.-) moos%)") then
- xchat.command("msg CrackBot sell moo $inv[moo] moo")
- end
- local cows=txt:match("%((.-) cows%)") or txt:match("%((.-) cow%)")
- if not cows then
- cows=txt:match("(%S+) baby cows are born")
- if cows then
- cows="+"..cows
- end
- end
- if cows then
- if cows:sub(1,1)=="+" then
- xchat.command("msg CrackBot sell cow "..cows:sub(2).." moo")
- else
- xchat.command("msg CrackBot buy cow "..cows:sub(2).." moo")
- end
- end
- end
- return xchat.EAT_NONE
- end
- function xchat_init()
- xchat.hook_command("MOO","cmd_moo",xchat.PRI_NORM,"MOO: Usage: moo on,off")
- xchat.hook_server("PRIVMSG","process_crackbot")
- end
- local running=false
- function moo()
- if not running then
- return false
- end
- xchat.command("msg CrackBot use cow moo")
- return true
- end
- function cmd_moo(word,eol,data)
- if running and word[2]=="off" then
- xchat.print("stopped mooing")
- running=false
- elseif not running and word[2]=="on" then
- xchat.print("started mooing")
- xchat.hook_timer(4000,"moo")
- running=true
- else
- xchat.print("Usage: moo [on,off]")
- end
- xchat.print("end")
- return xchat.EAT_XCHAT
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement