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.

a kick_on_ban script

Old posts that have not been replied to for several years.
Locked
d
duke_bot

a kick_on_ban script

Post by duke_bot »

this script doesn't work , it always gives null value "" for the vname variable , any idea why :(
it should msg mynick when a ban happens on #chan1 with the nick of the banned person ,
it always gives nick is banned
:(
any help why hand2nick doesn't work right

bind mode - "#chan1 +b" mode:kick_banned
proc mode:kick_banned { nick uhost hand chan mc victim } {
set vname "test"
set vname [hand2nick $victim $chan]
puthelp "PRIVMSG mynick : nick $vname is banned "
}
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

If I'm not wrong that means the victim dosen't have access to the eggdrop, is not an known user.. or something like this anyway.
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 »

No, this is actualy due tot he fact, he has got 2 command muddled up.

The hand2nick command is used to locate the first person matching a hostmask for a specific handle, and return the nickname.

This command is used to detect nicknames from handles, and not handles from nicknames.

Try using the nick2hand command, rather than hand2nick.
d
duke_bot

Post by duke_bot »

actually i want to get the nick of the victim , not his handle , so i think hand2nick is what i really should use , since i already have the handle of the victim , , , and by the way , merry christmas to ya all
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

YOu, you have the nickname of the victim allready.

Quoted from tcl-commands.doc
Description: mode changes are broken down into their component
parts before being sent here, so the <mode-change> will always
be a single mode, such as "+m" or "-o". victim will show the
argument of the mode change (for o/v/b/e/I) or "" if the set
mode does not take an argument. Flags are ignored. The bot's
automatic response to a mode change will happen AFTER all
matching Tcl procs are called. The mask will be matched against
'#channel +/-modes' and can contain wildcards.
This means that victim is not actualy a sutiable name for the arguemnt.

In reality, it should be balled mode_argument

If you see this on a cvhannel
PPSlim set mode +o hello
Then arguments of your script are as follows.

$nick = My nickname, ie ppslim
$uhost = My userhost, ie ident@host.name
$hand = My eggdrop handle, ie ppslim
$chan = The channel this mode took place on
$mc = The mode change, IE in this case +o
$victim = The argument applied to the mode, ie in this case hello

In the eggdrop bind system, only uses handles for the person triggering the event. IE, the person changing the mode.

If the mode change was a ban, $mc would equal +b and $victim would be the ban mask.
d
duke_bot

Post by duke_bot »

yes , but if u do a ban with the ip address , for example
bot set mode +o *!*@200.134.134.100
So i need to convert this to a nick, to kick it , coz i have to kick using a nick ,
so i have to use hand2nick

if the $victim argument is *!*@200.134.134.100
i need to have the corresponding nick for that
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

That is somthing totaly different.

handles, nicknames, banmasks, hostmasks are all different things, and muct be treated and obtained differently, on the information you have, and the information you can gain from it.

A handle is like a shell login username. While the person using the shell can be called somthing different each time, the login name allways remains the same. It is used as a persons identity in eggdrop. Each handle has a set of 1 or more hosts masks (can have 0, so they are never recognised on IRC) which are used to tell the differance from one person on IRC to another. Handles must follow the same rules for valid names, as defined for IRC nicknames in RFC 1459.

Nicknames are a persons CURRENT identity on IRC. They can change nickname at any time while they are on IRC. Eggdrop tells between them, as noted above, by there hostname, matching a certain mask.

Code: Select all

bind mode - "#chan1 +b" mode:kick_banned 
proc mode:kick_banned { nick uhost hand chan mc victim } { 
set vname "test" 
set vname [hand2nick $victim $chan] 
puthelp "PRIVMSG mynick : nick $vname is banned " 
}
In your script, it displays a message to the channel, when some1 is banned. However, it only accounts for one person. When you set a ban mask, it can match more than one person.

Everything is fine, until the point of using "hand2nick".
hand2nick <handle> [channel]
Returns: nickname of the first person on the specified channel (if one
is specified) whose nick!user@host matches the given handle; "" is
returned if no match is found. If no channel is specified, all channels
are checked.
Module: irc
This command takes a handle as a comulsary argument. A handle is, as noted abovee, a eggdrop login name. It will then look through all channels (unless one is specified), looking for a nickname, that matches a userhost mask, as defined in that handles records. On top of this, handles only exist for users that have a record on the bot.

This command does not take a mask.

There is no command that exists for this sort of thing, as of yet. However, there are command, that can be used, to obtain all users, and search through them yourself. This can be make into a function, that can be reused other script, like in the way you wish in your script.
d
duke_bot

Post by duke_bot »

Dear all , thanks alot , thanks ppslim , i have managed to do it some other way
here is a rough code , it has to be refined to check for ops ,and not to ban the botitself . the changes should be minor , i tried it , it works . Thanks again , and habbi meaw yeeeez

set mchannel "#chan1"
bind mode - "$mchannel +b" mode:kick_banned
proc mode:kick_banned { nick uhost hand chan mc victim } {
global mchannel
foreach i [chanlist $mchannel] {
set v $i![getchanhost $i]
# puthelp "PRIVMSG mynick : test $v nick $i victim $victim"
if {[string match -nocase "$victim" "$v"] == 1 } {
puthelp "PRIVMSG mynick : nick $i v $v "
putkick $mchannel $i "kick kick kick"
}
}
}
Locked