Is there a bot that can check a users share everytime they log in to see if their share is growing?
we require the users getting files to reshare them.
would be good if it sent a message to an op to say that Users share is no larger than last login.
hope to hear from someone soon :D
Hi,
Hope it helps...
--Requested by jsjen
--Made by nErBoS
Bot = "Share-Controler"
sharertxt = "shares.txt" --Will be created in the script folder
sh = {}
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
share = format("%0.2f", tonumber(share)/gb)
if (sh[user.sName] == nil) then
CheckShare(user, share)
elseif (sh[user.sName] > share) then
SendPmToOps(Bot, "The user "..user.sName.." has least share then is last loggin.")
sh[user.sName] = share
elseif (sh[user.sName] < share) then
SendPmToOps(Bot, "The user "..user.sName.." has more share then is last loggin.")
sh[user.sName] = share
end
end
function WriteUser(user, share)
local tmp = ""
if (readfrom(sharertxt) == nil) then
writeto(sharertxt)
write(user.sName.." & "..share.."\r\n")
writeto()
else
readfrom(sharertxt)
while 1 do
local line = read()
if (line == nil) then
break
else
local s,e,who,nshare = strfind(line, "(%S+)%s+%$%s+(%S+)")
if (who ~= nil and who == user and nshare ~= nil) then
if (tonumber(nshare) > share) then
SendPmToOps(Bot, "The user "..user.sName.." has least share then is last loggin.")
tmp = tmp..user.sName.." & "..share.."\r\n"
sh[user.sName] = share
elseif (tonumber(nshare) < share) then
SendPmToOps(Bot, "The user "..user.sName.." has more share then is last loggin.")
tmp = tmp..user.sName.." & "..share.."\r\n"
sh[user.sName] = share
else
tmp = tmp..user.sName.." & "..share.."\r\n"
end
else
tmp = tmp..line.."\r\n"
end
end
end
readfrom()
writeto(sharertxt)
write(tmp)
writeto()
end
end
Not tested, but think it will work :P
Best regards, nErBoS
thanks for responding so quick, the only thing is it doesnt seem to write to the txt file
I get this in the script editor while it is running
Syntax Error: attempt to perform arithmetic on global `gb' (a nil value)
I hope this helps I wish I could understand writing these
Hi,
Sorry my fault...
--Requested by jsjen
--Made by nErBoS
Bot = "Share-Controler"
sharertxt = "shares.txt" --Will be created in the script folder
sh = {}
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
share = format("%0.2f", tonumber(share)/(1024*1024*1024))
if (sh[user.sName] == nil) then
CheckShare(user, share)
elseif (sh[user.sName] > share) then
SendPmToOps(Bot, "The user "..user.sName.." has least share then is last loggin.")
sh[user.sName] = share
elseif (sh[user.sName] < share) then
SendPmToOps(Bot, "The user "..user.sName.." has more share then is last loggin.")
sh[user.sName] = share
end
end
function WriteUser(user, share)
local tmp = ""
if (readfrom(sharertxt) == nil) then
writeto(sharertxt)
write(user.sName.." & "..share.."\r\n")
writeto()
else
readfrom(sharertxt)
while 1 do
local line = read()
if (line == nil) then
break
else
local s,e,who,nshare = strfind(line, "(%S+)%s+%$%s+(%S+)")
if (who ~= nil and who == user and nshare ~= nil) then
if (tonumber(nshare) > share) then
SendPmToOps(Bot, "The user "..user.sName.." has least share then is last loggin.")
tmp = tmp..user.sName.." & "..share.."\r\n"
sh[user.sName] = share
elseif (tonumber(nshare) < share) then
SendPmToOps(Bot, "The user "..user.sName.." has more share then is last loggin.")
tmp = tmp..user.sName.." & "..share.."\r\n"
sh[user.sName] = share
else
tmp = tmp..user.sName.." & "..share.."\r\n"
end
else
tmp = tmp..line.."\r\n"
end
end
end
readfrom()
writeto(sharertxt)
write(tmp)
writeto()
end
end
Best regards, nErBoS
must be getting there. is there something missing
Syntax Error: attempt to call global `CheckShare' (a nil value)
does it write to teh file if theer is no entry for the first time user?
Hi,
That it's what it happens when i try to make two script at the same time.. :P
Sorry the function name was from another function, about the first entry i have a if to take care of that..
--Requested by jsjen
--Made by nErBoS
Bot = "Share-Controler"
sharertxt = "shares.txt" --Will be created in the script folder
sh = {}
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
share = format("%0.2f", tonumber(share)/(1024*1024*1024))
if (sh[user.sName] == nil) then
CheckShare(user, share)
elseif (sh[user.sName] > share) then
SendPmToOps(Bot, "The user "..user.sName.." has least share then is last loggin.")
sh[user.sName] = share
elseif (sh[user.sName] < share) then
SendPmToOps(Bot, "The user "..user.sName.." has more share then is last loggin.")
sh[user.sName] = share
end
end
function CheckShare(user, share)
local tmp = ""
if (readfrom(sharertxt) == nil) then
writeto(sharertxt)
write(user.sName.." & "..share.."\r\n")
writeto()
else
readfrom(sharertxt)
while 1 do
local line = read()
if (line == nil) then
break
else
local s,e,who,nshare = strfind(line, "(%S+)%s+%$%s+(%S+)")
if (who ~= nil and who == user and nshare ~= nil) then
if (tonumber(nshare) > share) then
SendPmToOps(Bot, "The user "..user.sName.." has least share then is last loggin.")
tmp = tmp..user.sName.." & "..share.."\r\n"
sh[user.sName] = share
elseif (tonumber(nshare) < share) then
SendPmToOps(Bot, "The user "..user.sName.." has more share then is last loggin.")
tmp = tmp..user.sName.." & "..share.."\r\n"
sh[user.sName] = share
else
tmp = tmp..user.sName.." & "..share.."\r\n"
end
else
tmp = tmp..line.."\r\n"
end
end
end
readfrom()
writeto(sharertxt)
write(tmp)
writeto()
end
end
Best regards, nErBoS
No error this time and still no response from the script.
also nothing is written in the txt file, I wish I could give you more information.
we have been testing it for 2 hours with different user types op reg guest vip
Hi,
Fixed and tested...
--Requested by jsjen
--Made by nErBoS
Bot = "Share-Controler"
sharertxt = "shares.txt" --Will be created in the script folder
sh = {}
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
share = format("%0.2f", tonumber(share)/(1024*1024*1024))
CheckShare(user, share)
end
OpConnected = NewUserConnected
function CheckShare(user, share)
local tmp = ""
local time = 0
if (readfrom(sharertxt) == nil) then
writeto(sharertxt)
write(user.sName.." & "..share.."\r\n")
writeto()
else
readfrom(sharertxt)
while 1 do
local line = read()
if (line == nil) then
if (time == 0) then
tmp = tmp..user.sName.." & "..share.."\r\n"
end
break
else
local s,e,who,nshare = strfind(line, "(%S+)%s+%&%s+(%S+)")
if (who ~= nil and who == user.sName and nshare ~= nil) then
if (tonumber(nshare) > tonumber(share)) then
SendPmToOps(Bot, "The user "..user.sName.." has least share then his last loggin.")
tmp = tmp..user.sName.." & "..share.."\r\n"
sh[user.sName] = share
time = 1
elseif (tonumber(nshare) < tonumber(share)) then
SendPmToOps(Bot, "The user "..user.sName.." has more share then his last loggin.")
tmp = tmp..user.sName.." & "..share.."\r\n"
sh[user.sName] = share
time = 1
end
else
tmp = tmp..line.."\r\n"
end
end
end
readfrom()
writeto(sharertxt)
write(tmp)
writeto()
end
end
Best regards, nErBoS
I think you can remove the beginner status your a fukn Legend.
saved our hub lots of hassles
is it possible to show before and after share sizes?
Im asking too much aint I
Hi,
Done..
--Requested by jsjen
--Made by nErBoS
Bot = "Share-Controler"
sharertxt = "shares.txt" --Will be created in the script folder
sh = {}
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
share = format("%0.2f", tonumber(share)/(1024*1024*1024))
CheckShare(user, share)
end
function CheckShare(user, share)
local tmp = ""
local time = 0
if (readfrom(sharertxt) == nil) then
writeto(sharertxt)
write(user.sName.." & "..share.."\r\n")
writeto()
else
readfrom(sharertxt)
while 1 do
local line = read()
if (line == nil) then
if (time == 0) then
tmp = tmp..user.sName.." & "..share.."\r\n"
end
break
else
local s,e,who,nshare = strfind(line, "(%S+)%s+%&%s+(%S+)")
if (who ~= nil and who == user.sName and nshare ~= nil) then
if (tonumber(nshare) > tonumber(share)) then
SendPmToOps(Bot, "The user "..user.sName.." has least share then his last loggin.")
SendPmToOps(Bot, "He had "..nshare.." GB and now he has "..share.." GB.")
tmp = tmp..user.sName.." & "..share.."\r\n"
sh[user.sName] = share
time = 1
elseif (tonumber(nshare) < tonumber(share)) then
SendPmToOps(Bot, "The user "..user.sName.." has more share then his last loggin.")
SendPmToOps(Bot, "He had "..nshare.." GB and now he has "..share.." GB.")
tmp = tmp..user.sName.." & "..share.."\r\n"
sh[user.sName] = share
time = 1
elseif (tonumber(nshare) == tonumber(share)) then
tmp = tmp..line.."\r\n"
time = 1
end
else
tmp = tmp..line.."\r\n"
end
end
end
readfrom()
writeto(sharertxt)
write(tmp)
writeto()
end
end
Best regards, nErBoS
I had an op ask this.
Is it possible to have something like a report on users shares when you do a command like !growthchart, which shows before and after results in another window?
They say it is hard to keep track of the private messages as they come up and need to see it another way to see what is happening.
I hope you understand what we are getting at. :(
we love your work. :D
Just a BIG SMILE ...
Nice Script...
A cmd like >> !sgrw would be nice , that is if the script misses users logging in .., But a test will be run as it is now ..
Hi,
The script will not miss if the user realy enters, but i have made the script to see the current share and the last share using the command you requested...
--Requested by jsjen
--Made by nErBoS
Bot = "Share-Controler"
sharertxt = "shares.txt" --Will be created in the script folder
sh = {}
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
share = format("%0.2f", tonumber(share)/(1024*1024*1024))
CheckShare(user, share)
end
function DataArrival(user, data)
if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="!sgrw") then
if (user.bOperator) then
local s,e,who = strfind(data,"%b<>%s+%S+%s+(%S+)")
if (who == nil or who == "") then
user:SendPM(Bot, "Syntax Error, !sgrw , you must write a name.")
else
user:SendPM(Bot, CheckUser(who))
end
else
user:SendPM(Bot, "You don?t have permission to use this command.")
end
return 1
end
end
end
function CheckUser(user)
local tmp = ""
if (readfrom(sharertxt) == nil) then
tmp = tmp.."the file hasn't been created yet."
else
readfrom(sharertxt)
while 1 do
local line = read()
if (line == nil) then
tmp = tmp.."The user "..user.." wasn't found in the listhave you write the right name ?"
break
else
local s,e,who,lshare, fshare = strfind(line, "(%S+)%s+%&%s+(%S+)%s+&%s+(%S+)")
if (who ~= nil and strlower(who) == strlower(user) and nshare ~= nil and fshare ~= nil) then
if (GetItemByName(user) ~= nil) then
tmp = tmp.."The user "..user.." is sharing "..lshare.." GB his last share was "..fshare.." GB."
else
tmp = tmp.."The user "..user.." has shared "..lshare.." GB."
end
break
end
end
end
readfrom()
end
return tmp
end
function CheckShare(user, share)
local tmp = ""
local time = 0
if (readfrom(sharertxt) == nil) then
writeto(sharertxt)
write(user.sName.." & "..share.." & 0\r\n")
writeto()
else
readfrom(sharertxt)
while 1 do
local line = read()
if (line == nil) then
if (time == 0) then
tmp = tmp..user.sName.." & "..share.." & 0\r\n"
end
break
else
local s,e,who,nshare = strfind(line, "(%S+)%s+%&%s+(%S+)%s+&%s+%S+")
if (who ~= nil and who == user.sName and nshare ~= nil) then
if (tonumber(nshare) > tonumber(share)) then
SendPmToOps(Bot, "The user "..user.sName.." has least share then his last loggin.")
SendPmToOps(Bot, "He had "..nshare.." GB and now he has "..share.." GB.")
tmp = tmp..user.sName.." & "..share.." & "..nshare.."\r\n"
sh[user.sName] = share
time = 1
elseif (tonumber(nshare) < tonumber(share)) then
SendPmToOps(Bot, "The user "..user.sName.." has more share then his last loggin.")
SendPmToOps(Bot, "He had "..nshare.." GB and now he has "..share.." GB.")
tmp = tmp..user.sName.." & "..share.." & "..nshare.."\r\n"
sh[user.sName] = share
time = 1
elseif (tonumber(nshare) == tonumber(share)) then
tmp = tmp..line.."\r\n"
time = 1
end
else
tmp = tmp..line.."\r\n"
end
end
end
readfrom()
writeto(sharertxt)
write(tmp)
writeto()
end
end
Best regards, nErBoS
mm every user I put in to the !sgrw command brings back wasn't found in the listhave you write the right name ?
I will keep trying but Ive done 9 people and no success.
can you make it do the entire list of users at once?
an advanced version of this could be specific files...
like my hub is for dvdrips and i want people to share back the dvdrips they download from us...is there anyway to mod the above script so it checks every users AVI files on login and compare with previous?
its kinda tuff i think but im pretty sure its possible...
im a noob in programming, i can doo basic c++ and some VB but thats about it hehe
:P
nErBoS
Again nicly done , one question ,
Iam tryng to add the cmd to Users Commands in Advanced section of dc++ but not sure what the cmd line should be to send Pm to bot if I right click on a Users Nick in the User Menu.
I started with by marking "PM" and "Users Menu" then Under "Command" I wrote !sgrw %[nick]
Greatfull
wow that s a cool Idea, can I get more info on how to do such commands we are a new hub and are all learning and it is hard to train ops who speak different languages.
I love this bot made our lives easier :D
Hi,
A little fix...
--Requested by jsjen
--Made by nErBoS
Bot = "Share-Controler"
sharertxt = "shares.txt" --Will be created in the script folder
sh = {}
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
share = format("%0.2f", tonumber(share)/(1024*1024*1024))
CheckShare(user, share)
end
OpConnected = NewUserConnected
function DataArrival(user, data)
if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="!sgrw") then
if (user.bOperator) then
local s,e,who = strfind(data,"%b<>%s+%S+%s+(%S+)")
if (who == nil or who == "") then
user:SendPM(Bot, "Syntax Error, !sgrw , you must write a name.")
else
user:SendPM(Bot, CheckUser(who))
end
else
user:SendPM(Bot, "You don?t have permission to use this command.")
end
return 1
end
end
end
function CheckUser(user)
local tmp = ""
if (readfrom(sharertxt) == nil) then
tmp = tmp.."the file hasn't been created yet."
else
readfrom(sharertxt)
while 1 do
local line = read()
if (line == nil) then
tmp = tmp.."The user "..user.." wasn't found in the list, have you write the right name ?"
break
else
local s,e,who,lshare, fshare = strfind(line, "(%S+)%s+%&%s+(%S+)%s+&%s+(%S+)")
if (who ~= nil and strlower(who) == strlower(user) ) then
if (GetItemByName(user) ~= nil) then
tmp = tmp.."The user "..user.." is sharing "..lshare.." GB his last share was "..fshare.." GB."
else
tmp = tmp.."The user "..user.." has shared "..lshare.." GB."
end
break
end
end
end
readfrom()
end
return tmp
end
function CheckShare(user, share)
local tmp = ""
local time = 0
if (readfrom(sharertxt) == nil) then
writeto(sharertxt)
write(user.sName.." & "..share.." & 0\r\n")
writeto()
else
readfrom(sharertxt)
while 1 do
local line = read()
if (line == nil) then
if (time == 0) then
tmp = tmp..user.sName.." & "..share.." & 0\r\n"
end
break
else
local s,e,who,nshare = strfind(line, "(%S+)%s+%&%s+(%S+)%s+&%s+%S+")
if (who ~= nil and strlower(who) == strlower(user.sName)) then
if (tonumber(nshare) > tonumber(share)) then
SendPmToOps(Bot, "The user "..user.sName.." has least share then his last loggin.")
SendPmToOps(Bot, "He had "..nshare.." GB and now he has "..share.." GB.")
tmp = tmp..user.sName.." & "..share.." & "..nshare.."\r\n"
sh[user.sName] = share
time = 1
elseif (tonumber(nshare) < tonumber(share)) then
SendPmToOps(Bot, "The user "..user.sName.." has more share then his last loggin.")
SendPmToOps(Bot, "He had "..nshare.." GB and now he has "..share.." GB.")
tmp = tmp..user.sName.." & "..share.." & "..nshare.."\r\n"
sh[user.sName] = share
time = 1
elseif (tonumber(nshare) == tonumber(share)) then
tmp = tmp..user.sName.." & "..share.." & "..nshare.."\r\n"
sh[user.sName] = share
time = 1
end
else
tmp = tmp..line.."\r\n"
end
end
end
readfrom()
writeto(sharertxt)
write(tmp)
writeto()
end
end
jsjen..
Try out this script here will solve your problem.
[G-T-E]Gate?..
The sysntax of your command is right but i would recomand to use the command in PM you may get disconnect from the Hub, just try but the syntax is right.
mau108..
That would spam the HUB with searches not recommended.
Best regards, nErBoS
nErBoS
Oh What A Beautiful Morning !!
I quoted a Wise Man in a thread once
Quote"Trial and Error sound be avoided if possible, it Keeps The Gray Hair Count To What is Is "
But Now Iam I dont agree with myself.
Conncerning the request on help for the sysntax to add to Users Commands,
well u were right but then I couldnt let it go so after a bit of "Trial and Error" I managed to get the CORRECT one working and I want to share it with everyone that uses ur script.
Settings in Advanced /Users Commands:
Command Type = Raw
Contex = Show Share Growth
Name = Your Choice
Command = $To: ShareCk? From: %[mynick] $<%[mynick]> !sgrw %[nick]|
HubIP/DNS = "op"
Thats it , Now just right click on the user and take "Show Share Growth" and the Bot will appear with the information if any is avaible since last log in..
Have A Nice Day .......
Hi you guys are the best
just 1 more question before I think of another
you say Contex = Show Share Growth
All I have under context is hub menu, user menu , search menu???
Im confused lol I use User menu but it doesnt seem to work :P
thanks for everything guys bye
Sorry jsjen I had to many Replies going..
QuoteSettings in Advanced /Users Commands:
Command Type = Raw
Contex = Show Share Growth
Name = Your Choice
Command = $To: ShareCk? From: %[mynick] $<%[mynick]> !sgrw %[nick]|
HubIP/DNS = "op"
Correction Below:
Settings in Advanced /Users Commands:
---------------------------------------------------------------------------------------------------------------
Command Type = Raw
Context = Your Choice =
Hub Menu, Users Menu; Search Menu Name = Show Share Growth
Command = $To: ShareCk? From: %[mynick] $<%[mynick]> !sgrw %[nick]|
HubIP/DNS = "op"
To = Your Bot Name
---------------------------------------------------------------------------------------------------------------
Silly Me ,
Im totally lost with this HAHA mmmmmmm
I right click on a user and I should see Show Share Growth ???
here is what I have I took this from my Favourites.xml
is it normal for the " to be " ?
Im sure I followed the instructions to the letter. :(
Maybe I should open another thread for help here sorry.
hope to hear from someone with this, im getting a head ache
Thanks nErBos for the script. It works fine. Only, I'm wondering if it would be possible to have say the last 10 logs and generate a list of users who's share size hasn't changed in 10 logs... either in decreasing or increasing...
thanks in advance,
Pieltre
Hi,
It could be done, but the 10 logs could be mistaken, for eg the user can reconnect 10 times in a role and have that 10 logs with the same hour, its very unsure.
Best regards, nErBoS
Thanks for the prompt reply. The idea I'm trying to push here is not to have everybody automatically listed in a pop bot, but more simply a database that would log the filesize of the share of each member (it would be a reg only hub...) for the past ten times. From that database, it would be great to have a command that would allow us to have a list of the users who's share hasn't either increased or decreased in the past 10 logs.... hence a list of all the bloody leechers....
If you think that can be done, who do you think could do it?
Nike,
Pieltre
Hi,
Yes it can, when a have a free time i will do that then.
Best regards, nErBoS
Excellent work as always nErBoS :D
another request: also display bot info, besides only botname in userlist
is it possible to edit the script so it only reports when the size changed >1gb? now i get reports from everyone, even when their sharesize dropped 100 kb...
otherwise it worx great