| View previous topic :: View next topic |
| Author |
Message |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Sun Aug 23, 2020 10:36 am Post subject: Checking for if user shares common channel with bot |
|
|
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 |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sun Aug 23, 2020 11:49 am Post subject: |
|
|
$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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Sun Aug 23, 2020 12:02 pm Post subject: |
|
|
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
 _________________ ComputerTech |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sun Aug 23, 2020 6:01 pm Post subject: |
|
|
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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Sun Aug 23, 2020 9:57 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Mon Aug 24, 2020 12:46 am Post subject: |
|
|
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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Tue Aug 25, 2020 12:48 am Post subject: |
|
|
I see, well me and simo have created a code to suit our needs, we'll post what we created in a few  _________________ ComputerTech |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Aug 25, 2020 11:02 am Post subject: |
|
|
| We didnt create anything we modified or rather i modified an existing code |
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Tue Aug 25, 2020 4:35 pm Post subject: |
|
|
Oh, didn't realise that *shrug*, anyway Thanks CrazyCat _________________ ComputerTech |
|
| Back to top |
|
 |
|