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.

Event when the bot is banned from a channel?

Help for those learning Tcl or writing their own scripts.
Post Reply
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Event when the bot is banned from a channel?

Post by juanamores »

I need to make a code to report when the BoT has been banned from a channel.
My idea is that the BoT report the channel, who banned and reason.

<bot> DeViL ban me in #chan1 for "do not want you on this channel".
I dont know event to trigger when the bot is banned.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

bind mode - "% +b" check:ban

proc check:ban {nick host hand chan mode target} {
	if {![matchaddr $target $::botname]} return
	# do whatever you wish as the ban mask matches bot address
}
The matchaddr is a eggdrop 1.6.20 function, so if you are using an older version would have to replace:

Code: Select all

if {![matchaddr $target $::botname]} return
with:

Code: Select all

if {![string match -nocase $target $::botname]} return
Once the game is over, the king and the pawn go back in the same box.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

Thanks caesar works fine. :)
For a KICK event would be so?

Code: Select all

bind kick - "% *!*@*" check:kick 
proc check:kick {nick user@host hand chan target reason} {
 global canal_admin
     if {"$target" != $::botnick}  return
   putmsg $canal_admin "$nick kick me  $chan  $reason"
}
It does not work that way.

EDIT:
I already fixed

Code: Select all

bind kick - "*" check:kick 
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

caesar have a problem with the type 2 ban.
+b *!*@virtual.host.of.my.bot
The [matchaddr $target $::botname] command return the internet company real host.
I need a command to return vhost bot.

See this post
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The botname variable should have stored his actual nick!user@host mask and should be updated when vhost changes (I think). Apparently it doesn't so give this a try:

Code: Select all

bind mode - "% +b" check:ban

proc check:ban {nick host hand chan mode target} {
   global botnick
   if {![matchaddr $target "$botnick![getchanhost $botnick]"]} return
   # do whatever you wish as the ban mask matches bot's current vhost
}
Once the game is over, the king and the pawn go back in the same box.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

caesar wrote:The botname variable should have stored his actual nick!user@host mask and should be updated when vhost changes (I think). Apparently it doesn't so give this a try:

Code: Select all

bind mode - "% +b" check:ban

proc check:ban {nick host hand chan mode target} {
   global botnick
   if {![matchaddr $target "$botnick![getchanhost $botnick]"]} return
   # do whatever you wish as the ban mask matches bot's current vhost
}
Not work.

Code: Select all

[matchaddr $target "$botnick![getchanhost $botnick]"]
Error: Tcl error [check:ban]: can't read "botnick": no such variable.
Return:
!0
And:

Code: Select all

[matchaddr $target "$::botnick![getchanhost $::botnick]"]
Return
0
Edit:format
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
Post Reply