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 

Check ops status on join a channel with Chanserv

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
firebugs
Voice


Joined: 30 Jun 2021
Posts: 3
Location: Penang

PostPosted: Sun Jul 11, 2021 11:15 pm    Post subject: Check ops status on join a channel with Chanserv Reply with quote

I'm new and i'm glad to be here Smile

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!
Back to top
View user's profile Send private message
DasBrain
Voice


Joined: 08 Apr 2021
Posts: 12

PostPosted: Mon Jul 12, 2021 8:21 am    Post subject: Reply with quote

I wrote this script for you: https://github.com/DasBrain/brain-tools/blob/master/dasbrain/cswhy-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.
Back to top
View user's profile Send private message
firebugs
Voice


Joined: 30 Jun 2021
Posts: 3
Location: Penang

PostPosted: Wed Jul 14, 2021 2:43 am    Post subject: Reply with quote

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/blob/master/dasbrain/cswhy-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.
Back to top
View user's profile Send private message
firebugs
Voice


Joined: 30 Jun 2021
Posts: 3
Location: Penang

PostPosted: Sun Jul 18, 2021 9:59 am    Post subject: Reply with quote

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

# 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/blob/master/dasbrain/cswhy-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.
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 848
Location: France

PostPosted: Sun Jul 18, 2021 10:49 am    Post subject: Reply with quote

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:
# 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"
      }
   }
}

_________________
https://www.eggdrop.fr
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
DasBrain
Voice


Joined: 08 Apr 2021
Posts: 12

PostPosted: Sun Jul 18, 2021 6:32 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 848
Location: France

PostPosted: Mon Jul 19, 2021 1:10 am    Post subject: Reply with quote

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

@firebugs: how did you set the +S to your services ? can you show us the user record for them ?
_________________
https://www.eggdrop.fr
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
DasBrain
Voice


Joined: 08 Apr 2021
Posts: 12

PostPosted: Mon Jul 19, 2021 1:32 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 848
Location: France

PostPosted: Mon Jul 19, 2021 3:00 am    Post subject: Reply with quote

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...
_________________
https://www.eggdrop.fr
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
DasBrain
Voice


Joined: 08 Apr 2021
Posts: 12

PostPosted: Mon Jul 19, 2021 11:58 am    Post subject: Reply with quote

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

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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