egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Quesation: Is it possible to do this with a TCL script?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
l8night
Voice


Joined: 17 Dec 2007
Posts: 12

PostPosted: Wed Dec 19, 2007 9:00 pm    Post subject: Quesation: Is it possible to do this with a TCL script? Reply with quote

Hi,

I'm new to tcl scripting and have an idea for a script, and I would just like to know if it is even possible before I attempt to write it.

Scenario:

I have a shell account that will get deleted if it is the oldest of 300 accounts. To check how old your account is you simply go to a certain IRC channel and type the command ' howold username ' and a bot will tell how many accounts are older than yours. I want to write a script for my eggdrop that will do this 'howold' command every so often, and when a certain number of accounts are older than mine, the bot will send an email to notify me to renew my shell account. The only part I'm really not sure about is if you can add mail server functionality to a script.

Any response or direction will be greatly appreciated.

Regards, Jeff
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Thu Dec 20, 2007 1:32 am    Post subject: Reply with quote

You will first have to find out how the age is determined. Simply going by uid may not work as some (if not most) shell providers configure their adduser scripts to reuse uids.

On most shells, using TCL exec command to run commandline mail is possible.
Back to top
View user's profile Send private message
l8night
Voice


Joined: 17 Dec 2007
Posts: 12

PostPosted: Thu Dec 20, 2007 1:52 am    Post subject: Reply with quote

The age of the account is determined like this----

There can only be 300 accounts total on the shell server.
You sign up for an account and there are 299 accounts older than yours. another person gets an account and now there's 298 accounts older than yours, when there are 0 accounts older than your account it's gets deleted.
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Thu Dec 20, 2007 9:21 am    Post subject: Reply with quote

l8night wrote:
The age of the account is determined like this----

There can only be 300 accounts total on the shell server.
You sign up for an account and there are 299 accounts older than yours. another person gets an account and now there's 298 accounts older than yours, when there are 0 accounts older than your account it's gets deleted.
This does not tell anyone how the age is figured out, this only restates the scenario.
So, I'll ask again. How do users know how old their account is?
Back to top
View user's profile Send private message
l8night
Voice


Joined: 17 Dec 2007
Posts: 12

PostPosted: Thu Dec 20, 2007 7:26 pm    Post subject: Reply with quote

ok ... I hope this makes since to you. I'm going to go and check the age of the account right now by going to this irc channel and typing in the command
howold myaccountname. This is the output that I got , At the moment there are 191 accounts older then "myaccount". That is how the age of my account is determined, by the number of accounts older than mine, or by the number of accounts newer than mine.
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri Dec 21, 2007 1:29 am    Post subject: Reply with quote

I suggest using a timer, or a time bind, to out put "howold account" to the channel.

You can use pubm bind to catch the reply based on "At the moment there are * accounts older then account", and suggest further creating a condition based on the uhost of the responding bot (to prevent some malicious user from simply creating a script that spits out "At the moment there are 1 accounts older then account" in reply to your bot's request).

Have the bot write the response it gets to a file, then use something like the following to send it:
Code:
exec mail -s "Account age" my@email.com < filename


Since you asked this in the "Scripting Help" forum, and not the request forum, these are the best tips I can give for your script because you provided none of the code you are using.
Back to top
View user's profile Send private message
l8night
Voice


Joined: 17 Dec 2007
Posts: 12

PostPosted: Fri Dec 21, 2007 1:37 am    Post subject: Reply with quote

Thanks a lot!! I'll take your suggestions and attempt to write my self a script.

I'll let you know how things go. Thanks again

Jeff
Back to top
View user's profile Send private message
l8night
Voice


Joined: 17 Dec 2007
Posts: 12

PostPosted: Fri Dec 21, 2007 8:44 pm    Post subject: Reply with quote

This is what I have so far:
Code:






bind time - "05 05 * * *" proc:putquick

 proc proc:putquick {} {

   putquick "howold l8night"
}

bind pubm -  At the moment there are * accounts older then l8night proc:gettext

 proc proc:gettext {} {}




I want to put the value represented by the * in a variable, I was thinking first put the whole "At the moment there are * accounts older than l8night" in a list, I guess my question is how would I capture that text and put it into a list.

Any response will be greatly appreciated


Jeff
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Sat Dec 22, 2007 12:45 pm    Post subject: Reply with quote

Code:
proc proc:gettext { nick uhost handle channel text } {
  regexp {there are (.*?) accounts older} $text match others
}

This will set the variable $others with the number of people after you.

"putquick" is a command used to tell eggdrop how fast to send information to the server, you have to put in the command what to send t the server.

Code:
putquick "PRIVMSG #channel :howold l8night"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber