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.

Check ops status on join a channel with Chanserv

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
firebugs
Voice
Posts: 3
Joined: Wed Jun 30, 2021 10:17 am
Location: Penang

Check ops status on join a channel with Chanserv

Post by firebugs »

I'm new and i'm glad to be here :-)

I'm looking for a script that will perform a "/msg chanserv why #channel op nickname" upon an op joining the channel.
The why command output should be notice to the channel ops only.

Thanks in advance
Cheersssss!
D
DasBrain
Voice
Posts: 13
Joined: Thu Apr 08, 2021 12:31 pm

Post by DasBrain »

I wrote this script for you: https://github.com/DasBrain/brain-tools ... why-1.0.tm

Some notes:
  • Services need the S flag.
  • The script is designed to work with the Atheme service package, in the English language.
  • To enable the script on a channel, use .chanset #channel +cswhy on the partyline.
  • The script is triggered when the services (someone with the +S flag) gives someone op.
User avatar
firebugs
Voice
Posts: 3
Joined: Wed Jun 30, 2021 10:17 am
Location: Penang

Post by firebugs »

My bad for not mentioning the network I'm on, I'm on dalnet but will give below script a try.
Thanks for your time and I do appreciate it!

DasBrain wrote:I wrote this script for you: https://github.com/DasBrain/brain-tools ... why-1.0.tm

Some notes:
  • Services need the S flag.
  • The script is designed to work with the Atheme service package, in the English language.
  • To enable the script on a channel, use .chanset #channel +cswhy on the partyline.
  • The script is triggered when the services (someone with the +S flag) gives someone op.
User avatar
firebugs
Voice
Posts: 3
Joined: Wed Jun 30, 2021 10:17 am
Location: Penang

Post by firebugs »

Below is the script, looks like it's not working, as I try to change it to puthelp "PRIVMSG ChanServ WHY $chan $target"

Code: Select all

# Brain-Tools
# Copyrigt DasBrain @ #John @ irc.quakenet.org

# File: cswhy-1.0.tm

# Asks chanserv what access someone has when they get ops from ChanServ.
# Designed for use with Atheme.

# Configs:

package require eggdrop 1.6
package require Tcl 8.5

package provide dasbrain::cswhy 1.0

namespace eval ::dasbrain::cswhy {
}

setudef flag cswhy

bind mode S "% +o" ::dasbrain::cswhy::onmode
bind notc S * ::dasbrain::cswhy::onnotice

proc ::dasbrain::cswhy::onmode {nick uhost hand chan mc target} {
	if {[channel get $chan cswhy]} {
		puthelp "PRIVMSG ChanServ WHY $chan $target"
	}
}

proc ::dasbrain::cswhy::onnotice {nick uhost handle msg target} {
	if {[regexp {has flags \002[^\002]+\002 in \002([^\002]+)\002 } $msg - chan]
		|| [regexp {has no special access to \002([^\002]+)\002} $msg - chan]} {
		if {[channel get $chan cswhy]} {
			putnotc @$chan $msg
		}
	}
}
firebugs wrote:My bad for not mentioning the network I'm on, I'm on dalnet but will give below script a try.
Thanks for your time and I do appreciate it!
DasBrain wrote:I wrote this script for you: https://github.com/DasBrain/brain-tools ... why-1.0.tm
Some notes:
  • Services need the S flag.
  • The script is designed to work with the Atheme service package, in the English language.
  • To enable the script on a channel, use .chanset #channel +cswhy on the partyline.
  • The script is triggered when the services (someone with the +S flag) gives someone op.
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

First, use code tags when putting script here, it's better for reading.

I'm skeptical about the bind mode S as the "S" is not a known flag, I don't know how it could work. Same for the bind notc.

What is putnotc ? A private proc not included in the script ?

And I think the PRIVMSG lacks ":":

Code: Select all

# Brain-Tools
# Copyrigt DasBrain @ #John @ irc.quakenet.org

# File: cswhy-1.0.tm

# Asks chanserv what access someone has when they get ops from ChanServ.
# Designed for use with Atheme.

# Configs:

package require eggdrop 1.6
package require Tcl 8.5

package provide dasbrain::cswhy 1.0

namespace eval ::dasbrain::cswhy {
}

setudef flag cswhy

bind mode - "% +o" ::dasbrain::cswhy::onmode
bind notc - * ::dasbrain::cswhy::onnotice

proc ::dasbrain::cswhy::onmode {nick uhost hand chan mc target} {
	if {[channel get $chan cswhy]} {
		puthelp "PRIVMSG ChanServ :WHY $chan $target"
	}
}

proc ::dasbrain::cswhy::onnotice {nick uhost handle msg target} {
	if {[regexp {has flags \002[^\002]+\002 in \002([^\002]+)\002 } $msg - chan]
		|| [regexp {has no special access to \002([^\002]+)\002} $msg - chan]} {
		if {[channel get $chan cswhy]} {
			putserv "NOTICE $chan :$msg"
		}
	}
} 
D
DasBrain
Voice
Posts: 13
Joined: Thu Apr 08, 2021 12:31 pm

Post by DasBrain »

CrazyCat wrote: I'm skeptical about the bind mode S as the "S" is not a known flag, I don't know how it could work. Same for the bind notc.
DasBrain wrote:Services need the S flag.
Uppercase flags can be freely used by scripts.
CrazyCat wrote: What is putnotc ? A private proc not included in the script ?
alltools.tcl - comes with eggdrop.
CrazyCat wrote: And I think the PRIVMSG lacks ":"
Yeah, somebody changed my code without understanding it.
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Oh yes, I didn't read your initial post and I'm not used to use alltools features :)

@firebugs: how did you set the +S to your services ? can you show us the user record for them ?
D
DasBrain
Voice
Posts: 13
Joined: Thu Apr 08, 2021 12:31 pm

Post by DasBrain »

My script has been written for Atheme, and works fine on libera.chat.

I suspect that DALnet uses a different response to the WHY command - so my script doesn't work.

As I don't use DALnet, I have no idea how their response looks like.
If you do, you just have to change the regexp to match their message.

And if DALnet doesn't support the CS command, then change it to CHANSERV, which is AFAIK supported.
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Adding putlog in different places may help to find which trouble occures, if bind is activated or not, which string is received, if the regexp matches...
D
DasBrain
Voice
Posts: 13
Joined: Thu Apr 08, 2021 12:31 pm

Post by DasBrain »

Sure, add those 3 lines at the end of the script:

Code: Select all

proc logargs args {putlog $args}
trace add execution ::dasbrain::cswhy::onmode {enter enterstep leave leavestep} logargs
trace add execution ::dasbrain::cswhy::onnotice {enter enterstep leave leavestep} logargs
Post Reply