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.

Kickban script..

Old posts that have not been replied to for several years.
Locked
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Kickban script..

Post by GodOfSuicide »

i wanted to add a little feature to my bot :

any OP in a channel (not bot flag op, but channel op) can msg the bot to kick / kickban / ban a user on the channel with a given reason.

This feature would allow ppl to hide behind the bot.

mfg gos
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

As Extracted from my Eggdrop...
[19:58:49] <Weirdo> .help kickban
[19:58:49] <Minako> [19:58] #Weirdo# help kickban
[19:58:49] <Minako> ### kickban [channel] [-|@]<nickname> [comment]
[19:58:49] <Minako> kicks a user off the channel and bans her by a reasonable host-
[19:58:49] <Minako> mask. your nickname will be attached to the ban in the bot's
[19:58:49] <Minako> internal ban list, and the ban will last for whatever is set in
[19:58:49] <Minako> ban-time -- only on this channel. use '.+ban' for a more
[19:58:49] <Minako> permanent ban which will be activated on every channel the bot
[19:58:49] <Minako> monitors. if you use a comment, that will also be attached to
[19:58:49] <Minako> the ban in the ban list, and used as the kick comment.
[19:58:49] <Minako> appending a prefix of ! or @ to a nickname changes the ban
[19:58:49] <Minako> mask used:
[19:58:49] <Minako> e.g. with a host of nick!ident@host.name.domain
[19:58:49] <Minako>
[19:58:49] <Minako> command banmask
[19:58:49] <Minako> .kickban nick *!*dent@*.name.domain
[19:58:49] <Minako> .kickban -nick *!*dent@host.name.domain
[19:58:49] <Minako> .kickban @nick *!*@host.name.domain
[19:58:49] <Minako>
[19:58:49] <Minako> with a host of nick!~ident@host.name.domain (strict-host set to 1)
[19:58:49] <Minako>
[19:58:49] <Minako> command banmask
[19:58:49] <Minako> .kickban nick *!*ident@*.name.domain
[19:58:49] <Minako> .kickban -nick *!*ident@host.name.domain
[19:58:49] <Minako>
[19:58:49] <Minako> see also: +ban, bans, stick
This command is built into the channels module, as well as kick as well as +ban

if you do .help on any of these, itll give you the syntax
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

but i dont want to use interenal banlist cos members should be able to unban him

also it should ban by a specified mask (*!iden@*.domain) etc
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

You could just unbind the -ban commands to everyone but owners/masters

that prevents unbanning you dont want.

Do a search for "Unbinding Halfops" as a topic, and ppslim helped me achieve that with my bot, you can do something simular to achieve the higher security
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

set hide(chan) "#your_channel"

bind msg * kick hide:kick
bind msg * ban hide:ban
bind msg * kickban hide:kickban

# kick
proc hide:kick {nick host hand arg} {
global botnick hide
if {![isop $nick $hide(chan)] || ![botisop $hide(chan)]} { return }
if {[llength $arg] < 1} {
putserv "PRIVMSG $nick :\002Usage\002: kick <victim> \[reason\]"
putserv "PRIVMSG $nick :Notice that this works only for the $hide(chan) channel."
return }
set vict [lindex $arg 0]
set reas [lrange $arg 1 end]
if {$reas == "" } { set reas "request" }
if {$vict == $botnick} { return }
if {![onchan $vict $hide(chan)]} { return }
putkick $hide(chan) $vict $reas
return }

# ban
proc hide:ban {nick host hand arg} {
global botname hide
if {![isop $nick $hide(chan)] || ![botisop $hide(chan)]} { return }
if {![llength $arg] > 0 } {
putserv "PRIVMSG $nick :\002Usage\002: ban <mask>"
putserv "PRIVMSG $nick :Notice that this works only for the $hide(chan) channel."
return }
set ban [lrange $arg 0 end]
if {[string match "$ban" "$botname"]} {
putserv "PRIVMSG $nick :This ban matches me :P~"
return }
putserv "MODE $hide(chan) +b $ban"
return }

# kickban
proc hide:kickban {nick host hand arg} {
global botnick botname hide
if {![isop $nick $hide(chan)] || ![botisop $hide(chan)]} { return }
if {[llength $arg] < 1} {
putserv "PRIVMSG $nick :\002Usage\002: kickban <victim> \[reason\]"
putserv "PRIVMSG $nick :Notice that this works only for the $hide(chan) channel."
return }
set vict [lindex $arg 0]
set reas [lrange $arg 1 end]
if {$reas == "" } { set reas "request" }
if {$vict == $botnick} { return }
if {![onchan $vict $hide(chan)]} {
putserv "PRIVMSG $nick :$vict is not on $hide(chan)."
return }
set ban "*!*@[lindex [split [getchanhost $nick $hide(chan)] @] 1]"
if {[string match "$ban" "$botname"]} { set ban "*!*[getchanhost [lindex $arg 0] $hide(chan)]" }
putserv "MODE $hide(chan) +b $ban"
putkick $hide(chan) $vick $reas
return }
I haven't figured out an other way for the chk of the channel, so you may use this only for a channel. I can make an foreach [chanlist] and chk if is op but then will have to be op on all the channels the bot is on to have access to the commands. I'm still thinking to an alternative of how to do this. I can make it for more than one channel but then $nick will must have op on all the channels. Tell me if you encount problems or you have sugestions of any kind related about this code.

Have fun. :)

PS: Weirdo : he asked for an msg not an dcc and without access to the eggdrop, not the +o flag on the eggdrop, just @ on the channel.. doh! :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

thx caesar, gonna test it now

[EDIT]
when i try the kickban command it just sets MY hotmask on the channel banlist and doesnt kick anyone..

the ban cmd also just sets the nickname with <nick>!*@* in banlist...
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

For the ban command you must specify the mask to ban on the channel. e.g.: ban *!*foo@bar.com

Please do a msg to your eggdrop with the folowing commands: kick, ban and kickban to see an eplication how they work. Also, sorry for the typing, search in the tcl file and modify:

from:
putkick $hide(chan) $vick $reas

with:
putkick $hide(chan) $vict $reas

from:
if {![isop $nick $hide(chan)] || ![botisop $hide(chan)]} { return }

with:
if {![validchan $hide(chan)] || ![isop $nick $hide(chan)] || ![botisop $hide(chan)]} { return }

And it should work smoothly. Please tell me if you find any problems or something like this.

Have fun. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

a fix banmask would be perfekt..

like *!*ident@*.host.com

btw : the script still ban's the person that writes the trigger...
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I have tested and found an typing error. Sorry about that..

Change the kickban with this:

Code: Select all

# kickban 
proc hide:kickban {nick host hand arg} { 
global botnick hide 
if {![validchan $hide(chan)] || ![isop $nick $hide(chan)] || ![botisop $hide(chan)]} { return } 
if {[llength $arg] < 1} { 
putserv "PRIVMSG $nick :\002Usage\002: kickban <victim> \[reason\]" 
putserv "PRIVMSG $nick :Notice that this works only for the $hide(chan) channel." 
return } 
set vict [lindex $arg 0] 
set reas [lrange $arg 1 end] 
if {$reas == "" } { set reas "request" } 
if {$vict == $botnick} { return } 
if {![onchan $vict $hide(chan)]} { 
putserv "PRIVMSG $nick :$vict is not on $hide(chan)." 
return } 
set ban "*!*[string trimleft [getchanhost [lindex $arg 0] $hide(chan)] ~]"
putserv "MODE $hide(chan) +b $ban" 
putkick $hide(chan) $vict $reas 
return }
Now should works smoothly.. I have changed the mask to: *!*foo@bar.com Tell me if you would like to make it how you said.
Once the game is over, the king and the pawn go back in the same box.
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

thx, works fine now :D

perfekt ban type would be *!ident@*provider.com

like getting xxxxxxx.adsl.highway.telekom.at -> highway.telekom.at

banhost should be the last 3 parts of the hotmask.

btw : everything works fine now :D
Locked