egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Checking for if user shares common channel with bot

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sun Aug 23, 2020 10:36 am    Post subject: Checking for if user shares common channel with bot Reply with quote

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:

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



Code:

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Sun Aug 23, 2020 11:49 am    Post subject: Reply with quote

$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:
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
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sun Aug 23, 2020 12:02 pm    Post subject: Reply with quote

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

Very Happy
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Sun Aug 23, 2020 6:01 pm    Post subject: Reply with quote

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
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sun Aug 23, 2020 9:57 pm    Post subject: Reply with quote

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 Smile
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Mon Aug 24, 2020 12:46 am    Post subject: Reply with quote

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.
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Tue Aug 25, 2020 12:48 am    Post subject: Reply with quote

I see, well me and simo have created a code to suit our needs, we'll post what we created in a few Razz
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Aug 25, 2020 11:02 am    Post subject: Reply with quote

We didnt create anything we modified or rather i modified an existing code
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Tue Aug 25, 2020 4:35 pm    Post subject: Reply with quote

Oh, didn't realise that *shrug*, anyway Thanks CrazyCat
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber