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.

Eggdrop Unban Tcl Script

Old posts that have not been replied to for several years.
Locked
a
aristosv

Eggdrop Unban Tcl Script

Post by aristosv »

I need a script that can do the following:

When someone bans the eggdrop,the eggdrop will unban itself,ban and kick the user that banned it, and rejoin the channel and become operator again.

Is there a script that can do all that?Is it very difficult to create one?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

yes and no.

Yes: It can be scripted to do this. I am unaware, if there is a script that does this allready, but it is possible to create one.

No: You have not provided much infomation on how it will do this.

How will the bot do this. Via services (if the netwokr has them).

If not, what method should be used.
a
aristosv

Eggdrop Unban Tcl Script

Post by aristosv »

The eggdrop will unban itself,ban the user that banned it,rejoin the channel and become operator again,using undernet's X services.

It's a very usefull script because,when my eggdrop gets banned in a channel,it cannot punish the user that did it,cannot rejoin the channel and become operator again,even if the user who did it has a lower access level than my eggdrop.

The only thing it can do,WHEN someone unbans it...it will just rejoin and become operator.Nothing else.
So the user that banned it can do it again freely.

What can i do?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

set x(channels) "#channel1 #channel2 #channel3"

bind kick - "*" kick:extract
bind mode - "* +b" xstuff:ban
bind need - * xstuff:need

# Remuser
proc kick:extract {nick uh hand chan vict reas} {
global botnick
if {$nick != "X"} { return }
set kicker [string trim [lindex [split $reas] 0] {()}]
if {$vict == $botnick} {
putserv "PRIVMSG X :remuser $chan ${kicker}" }
return }

# Unban
proc xstuff:ban {nick uhost hand chan mc ban} {
global botnick botname
set bmask "*!*@[lindex [split $uhost @] 1]"
if {[string match "$ban" "$botname"] && [botisop $chan]} {
if {[string match "$bmask" "$botname"]} { set bmask [maskhost *!*[string trimleft $uhost ~]]}
putserv "MODE $chan -bo+b $ban $nick $bmask"
putserv "KICK $chan $nick :\002Don't ban me you twit!\002" }
return }

# Needs
proc xstuff:need {channel type} {
global botnick x
if {[lsearch -exact $x(channels) $channel] == -1} {return 0}
if {$type == "op" && [onchan X $channel]} { putserv "PRIVMSG X :op $channel $botnick" }
if {$type == "unban"} { putserv "PRIVMSG X :unban $channel $botnick" }
if {$type == "invite"} { putserv "PRIVMSG X :invite $channel $botnick" }
if {$type == "limit"} { putserv "PRIVMSG X :invite $channel $botnick" }
return 1 }

See this. :)
a
aristosv

Eggdrop Unban Tcl Script

Post by aristosv »

ok...I guess all i have to do now,is edit this part:
set x(channels) "#channel1 #channel2 #channel3 with the channels i want it to work on.
Copy and paste it in a txt file,rename it to .tcl and load it on the eggdrop right???
a
aristosv

Eggdrop Unban Tcl Script

Post by aristosv »

Ok.
I have tried the script and it works just fine.
Thank you very much.
Just one more thing,if i want the script to work by default in any channel i put the eggdrop in,what do i have to put here:
set x(channels) "#channel1 #channel2 #channel3"
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Locate and remove the following line

Code: Select all

if {[lsearch -exact $x(channels) $channel] == -1} {return 0}
a
aristosv

Post by aristosv »

Thank you very much :)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

You're welcome. :)
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Re: Eggdrop Unban Tcl Script

Post by egghead »

I need a script that can do the following:

When someone bans the eggdrop,the eggdrop will unban itself,ban and kick the user that banned it, and rejoin the channel and become operator again.

Is there a script that can do all that?Is it very difficult to create one?
Hi Aristosv. The sequence of events you descibe is a bit odd: first the user gets kicked by the bot and then the bot rejoins the channel.

A more intricate sequence could be like:
1. userA sets a ban on the bot like: *!*botusername@*
2. userB deops the bot
3. userC kicks the bot
4. before the bot rejoins, userD sets another ban like: *!*@botshostname

The bot can take action against the first three offenses, because the bot is on the channel when the offenses occur. Such an action can be that the bot adds a ban to its internal ban list. You can write a script to perform these actions.

The fourth offense, however, makes the bot unable to join the channel. In that case you can request the list of bans from the server and see which masks match the bot and consequently ask the service to remove these bans. Such a request can be made using a bind to "need unban".

I'm not sure about the X-service, but on dalnet one can request Chanserv to remove all the bans matching the bot. Additionally, some servers also return the hostmask of the user placing the ban. That particular information can be used to punish offenders :) You can write such a script using the RAW bindings, binding to codes 367 and 368.

An example of such a script (for dalnet) is at http://members.fortunecity.com/eggheadt ... an.tcl.txt
Locked