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.

Checking for if user shares common channel with bot

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Checking for if user shares common channel with bot

Post by ComputerTech »

Hey all, so me and simo have been making a script that shows kill info, If the killed user and the bot shares a channel, this is the code we got so far
it's not currently working heh, this is the error.

Code: Select all

[15:35:27] Tcl error [serv:killed]: can't read "chan": no such variable

Code: Select all

bind raw - NOTICE serv:killed

proc serv:killed {from key text} {
	if {[string match *!*@* $from]} {
		return 0; # not a server notice
	}
    if {[string match "*Received KILL message for*" $text]} {
      set text [string map [list \017 ""] [stripcodes abcgru $text]]
	  #set nick2 [join [lrange [split $text] 6 7]] 
	  set nick2 [lindex [split $text] 6]
	  set nick3 [lindex [split $text] 7]
	  set by [lindex [split $text] 9]
	  set reason [join [lrange [split $text] 10 end]] 
 foreach n [chanlist $chan] {
  foreach c [channels] {
    if {![botisop $c] && [isbotnick $n] && [isop $n $c] && [ishalfop $n $c] && [matchattr [nick2hand $n] $accessFlags $c]} {return}
      putserv "privmsg $c [red] \-\-\[Killed\]\-\- [green] $nick2 [blue] $nick3 [brown] by: [red] $by [blue] Reason : [purple] $reason [nocolor]" 
  }
 }
}
	return 0
}
Thanks in advanced all[/code]
ComputerTech
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

$chan doesn't exists.
You received a kill notice (network/server event), there is no channel information.

The end of your procedure seems to be inverted:

Code: Select all

foreach c [channels] {
   # list all channels the eggdrop is on
   foreach n [chanlist $c] {
      # list all people on $c channel
      if {![botisop $c] && [isbotnick $n] && [isop $n $c] && [ishalfop $n $c] && [matchattr [nick2hand $n] $accessFlags $c]} {return}
      putserv "privmsg $c [red] \-\-\[Killed\]\-\- [green] $nick2 [blue] $nick3 [brown] by: [red] $by [blue] Reason : [purple] $reason [nocolor]"
   }
}
I'm not sure I understand your conditions to have the return:
"Bot is not @" AND "user is not bot" AND "user is @" AND "user is %" AND "user has $accessflags on channel"... Strange
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

Ok, let me try to describe again better.

User gets killed, If user getting killed and bot shares a channel, output the kill message, if they do not share a channel, return

:D
ComputerTech
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Well well well...
So you can just get the bind SIGN and check if it contains a kill prefix.

When you get the killed notice, the user is no more on chans, so you can't know if it was or not in a channel shared with the eggdrop.

And I don't understand why you want the eggdrop relays the kill on the channel the user was in when the kill is already the quit message of the user
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

I do not wish to relay to the same channel as the user has been killed in,
i wish to relay the kills to a specify, Oper Only channel, for monitoring

so if John is killed in #channel1
and Bot is in #channel1

in #oper Bot will say john has been killed in #channel1

Thats all i need :)
ComputerTech
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Ok, I understand, and I think you didn't understand some little things
Kill is network wide, not channel relative. As I said before, you can catch the SIGN message in channels containing the killed message, but if John shares 9 channels with Bot, Bot will tell 9 times in #oper that John has been killed ?
And it will be false to say that john has been killed in #channel1, John was killed from the network.

If Bot1 kills John, Bot1 can advertise in #oper that it does because John must be punish in #channel1, no reason to wait for the server notice.
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

I see, well me and simo have created a code to suit our needs, we'll post what we created in a few :P
ComputerTech
s
simo
Revered One
Posts: 1079
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

We didnt create anything we modified or rather i modified an existing code
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

Oh, didn't realise that *shrug*, anyway Thanks CrazyCat
ComputerTech
Post Reply