This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

automatic message on adduser

Old posts that have not been replied to for several years.
Locked
M
MrT
Voice
Posts: 11
Joined: Wed Nov 06, 2002 11:57 pm

automatic message on adduser

Post by MrT »

hi,

I was just wondering if there is a way of having the bot automatically send a message to a user that has just been added telling them how to set their password?

Sort of like when you message the bot "hello" to add yourself and the bot then tells you you were added and tells you to set a pass, except it would be me adding them and then being lazy and having the bot explain for me how to set a pass.

On the same note, a message to the user telling them they were added would be good...

Thanks,

MrT
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Use a bind msg if you want something like an hello. You should browse the TCL Archive and get one and look how it's done, also you can do a forum search. Anyway, I'm shure you'll find something usefull.
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Code: Select all

bind FILT - ".adduser *" myfilt:adduser
proc myfilt:adduser {idx text} {
  if {[string index [set nick [lindex [split $text] 1]] 0] == "!"} {
    set nick [string range $nick 1 end]
  }
  if {[set newhand [lindex [split $text] 2]] == ""} {
    set newhand $nick
  }
  if {[validhand $newhand]} { return $text } 
  *dcc:adduser [idx2hand $idx] $idx [join [lrange [split $text] 1 end]]
  if {[validuser $newhand]} {
    puthelp "NOTICE $nick :You have now been added to this bot"
    puthelp "NOTICE $nick :You need to set a password, using the following command."
    puthelp "NOTICE $nick :/msg $::botnick pass <password>"
    puthelp "NOTICE $nick :Replacing <password> with a secure, unique password"
    puthelp "NOTICE $nick :After this, you may see the commands available by typing"
    puthelp "NOTICE $nick :/msg $::botnick help"
  }
  return ""
}
That should do what you need, without having to re-code vital portions of the bot.
M
MrT
Voice
Posts: 11
Joined: Wed Nov 06, 2002 11:57 pm

Post by MrT »

that looks like exactly what im looking for :D

one small problem (im basically a bit of a noob at the coding side of things although ive been playing with eggrops for a while...), i just had a go of the code exactly as you wrote it and i get an error:
Tcl error [myfilt:adduser]: invalid command name "validhand"
is this another case of an old tcl version on my shell? (i've had problems with that before - i spoke to my provider and it should be upgraded soon i hope)

thanks for your time :)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Luckily, no.

Locate the word validhand and change my stupid mistake to validuser.
M
MrT
Voice
Posts: 11
Joined: Wed Nov 06, 2002 11:57 pm

Post by MrT »

ahhh i see :)

one final adjustment i had to make was to change puthelp to putserv... i dont know if its just a network thing or what but it works great now.

Thanks

MrT
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Puthelp should work fine, and is advised.

Seeing as the puthelp queue is the least priority, it may be that the other queues have data to dump.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Also an "bind FILT - ".+user*" myfilt:adduser" will be nice. :)

PS: And I was not talking about "having to re-code vital portions of the bot." Anyway, it's nice.
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

2 things.

1: It should be ".+user *" (note the space). While not a secuity issue, it does stop un-needed code calls.

2: You can't use the script given for the +user command.

The +user command takes a hostmask as the second argument, and would thus make the above script go a little nuts.

I use somthing simalar to the script given, however, I leave +user out, so I still have control when a message should be sent.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Actualy the second argument is an nick as you can see: +user <nickname> [hostmask] and for adduser it's: adduser [!]<nickname> [handle] so.. they are aproximative the same thing with one minor difference, the "!" thing.

And about the +user space * it's ok if is "+user*" or "+user *". The only difference betwen them is that the first one matches all the commands that start with +user (I doubt there is one that starts with +user and is not it), the other one mathches only the +user one. So basicaly your's is correct, and mine is not wrong.
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Re-read my code, and then re-read ".help +user" & ".help adduser".

I don't mean to bitch about it, but they are 100% different in there actions.

EG
.+user ppslim ppslim!*ident@host.com
.adduser ppslim slimbot
Adduser uses a handle. My script has to parse this out, otherwise, it doesn't know if the user has been added or not.

EG, if only the nickname is give, then the nickanme is the handle too. If the handle is given too, then the handle may be different.

With +user, the second argument is a hostmask. Hostmasks are not handles, and as such, any occurance of the hostmask in the command, would cause my script not to message the user.
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

.command argument1 argument2

afaik
photon?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I agree with you that the code you've pasted needs some changes in order it to work with the +user thing. My appologies.
Once the game is over, the king and the pawn go back in the same box.
Locked