Development Section > HOW-TO's

HOW-TO: Write your own bot = Lesson 5

(1/2) > >>

pHaTTy:
ok from lesson 4 we had


--- Code: ---Bot = "Keiko"

version = "0.4"
NEWCON = 1
prefix = "!"

function Main()
frmHub:RegBot(Bot)
SetTimer(60000)
StartTimer() --In the main function because it starts the timer on hub start or restart
end

function OnTimer() --This is what will be sent on the timer
SendToAll(Bot,"-------------------------------")
SendToAll(Bot,"--Write your own bot lesson 4--")
SendToAll(Bot,"-------------------------------")
end

function NewUserConnected(user)
if NEWCON == 1 then
user:SendData (Bot,"A User has connected")
end
end

function OpConnected(user)
if user.iProfile == 0 then
user:SendData(Bot,"Hello Master "..user.sName.." How are you")
return 1
else
SendToAll(Bot,"A Op has entered")
end
end

function DataArrival(user,data)
if strsub(data, 1, 1) == "

kepp:
:D  thanks alot, i learned a few things here :)

keep it up ;)

pHaTTy:
thx and yep will do :o)

Tuben:
Nice.. ;))

pHaTTy:
thx :o)

Navigation

[0] Message Index

[#] Next page

Go to full version