-- AutoBot.lua, created by Ptaczek Dec-24, 2002, modified on Dec-31, 2002 -- A simple implementation of the share checker, MoGlo kicker and -- operator login announcer --// BotName Bot = "LuaBot" kb = 1024 mb = kb*kb gb = kb*kb*kb minShare = 2 * gb --// This function is fired at the serving start function Main() frmHub:RegBot(Bot) end --// This function is fired when a new data arrives function DataArrival(curUser, sData) --// get rid of [MoGLO] if strsub(sData, 1, 13) == "$ValidateNick" then nick = strsub(sData, 15, -2); if strfind(strlower(nick), "moglo", 1) then curUser:Disconnect() end end end --// This function is fired when a new user finishes the login function NewUserConnected(curUser) --// check the share --// extract the share number from MyInfo string using regular expression i,j,temp = strfind(curUser.sMyInfoString, "$(%d+)%$") --// if we didn't got the number, just disconnect the user and return if temp == nil then curUser:Disconnect() return end --// format the output string Share = format("%0.2f", tonumber(temp)/gb) --// and send some notes to the users main chat window. I hate the logon popups :) curUser:SendData("<"..Bot.."> Hi "..curUser.sName..". The minShare is set to "..minShare/gb.." Gb. Operators are not checked.") curUser:SendData("<"..Bot.."> You are sharing "..Share.." Gb.") --// finally check the share and kick the user if lower if tonumber(temp) < minShare then curUser:SendPM("ShareCheck", "You don't met the share minimum"..minShare/gb.." Gb") curUser:SendPM("ShareCheck", "Disconnecting...") curUser:Disconnect() end end --// This function is fired when an operator enters the hub function OpConnected(curUser) SendToAll(Bot, "Operator "..curUser.sName.." has entered the hub.") end --// This function is fired when an operator disconnects function OpDisconnected(curUser) SendToAll(Bot, "Operator "..curUser.sName.." went off...") end