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.

Ircop eggdrop bot with SACommands

Help for those learning Tcl or writing their own scripts.
s
simo
Revered One
Posts: 1080
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Yusif wrote:can you please do modify in this script for simple use?
need it work in #Chanops .. when the chanop need to op in any room by bot, he/she have to type:
!op #chan to get op in that room + confirm msg in #chanops he/she opped
!deop #chan to drop op + confirm msg in #chanops he/she deopped
!hop #chan to get halfop + confirm msg in #chanops he/she halfop
!dehop #chan to dehalfop + confirm msg in #chanops he/she dehop

thanks
Why not use chanserv for that?
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

simo wrote:Why not use chanserv for that?
we use chanserv but opers not around all time to op chanops
s
simo
Revered One
Posts: 1080
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

The design of chanserv auto - admins/ops/hops list is to work without the need of any oper being around.
s
simo
Revered One
Posts: 1080
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Yusif wrote:
simo wrote:Why not use chanserv for that?
we use chanserv but opers not around all time to op chanops
you could try this :

Code: Select all



 

set chanopschan "#chanops"

bind pub -|- !op Pub:OP:monotor-channel

proc Pub:OP:monotor-channel {nick host hand chan text} {
   set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
   set items [split $text]

   set chan [string tolower $chan]

   if {[llength $items] < 1 } { putnow "notice $nick :Syntax is !op \#chan" ; return }

   set enforcechan [lindex [split $text] 0]

   if {![string equal -nocase $chan "$::chanopschan"] || [string first "#" $enforcechan] == -1} { return 0 }

   if {[isop $nick $::chanopschan] || [ishalfop $nick $::chanopschan] || [matchattr $hand o|o $::chanopschan]} {  
   if {[botisop $enforcechan] && ![isop $nick $enforcechan] && [onchan $nick $enforcechan] && [onchan $::botnick $enforcechan]} { pushmode $enforcechan +o $nick }
   }
  }
}   






bind pub -|- !deop Pub:DEOP:monotor-channel

proc Pub:DEOP:monotor-channel {nick host hand chan text} {
   set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
   set items [split $text]

   set chan [string tolower $chan]
   
   if {[llength $items] < 1 } { putnow "notice $nick :Syntax is !op \#chan" ; return }

   set enforcechan [lindex [split $text] 0]

   if {![string equal -nocase $chan "$::chanopschan"] || [string first "#" $enforcechan] == -1} { return 0 }

   if {[isop $nick $::chanopschan] || [ishalfop $nick $::chanopschan] || [matchattr $hand o|o $::chanopschan]} {  
   if {[botisop $enforcechan] && [isop $nick $enforcechan] && [onchan $nick $enforcechan] && [onchan $::botnick $enforcechan]} { pushmode $enforcechan -o $nick }
   }
  }
}   







bind pub -|- !hop Pub:HOP:monotor-channel

proc Pub:HOP:monotor-channel {nick host hand chan text} {
   set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
   set items [split $text]

   set chan [string tolower $chan]
   
   if {[llength $items] < 1 } { putnow "notice $nick :Syntax is !op \#chan" ; return }

   set enforcechan [lindex [split $text] 0]

   if {![string equal -nocase $chan "$::chanopschan"] || [string first "#" $enforcechan] == -1} { return 0 }

   if {[isop $nick $::chanopschan] || [ishalfop $nick $::chanopschan] || [matchattr $hand o|o $::chanopschan]} {  
   if {[botisop $enforcechan] && ![ishalfop $nick $enforcechan] && [onchan $nick $enforcechan] && [onchan $::botnick $enforcechan]} { pushmode $enforcechan +h $nick }
   }
  }
}   





bind pub -|- !dehop Pub:DEHOP:monotor-channel

proc Pub:DEHOP:monotor-channel {nick host hand chan text} {
   set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
   set items [split $text]

   set chan [string tolower $chan]
   
   if {[llength $items] < 1 } { putnow "notice $nick :Syntax is !op \#chan" ; return }

   set enforcechan [lindex [split $text] 0]

   if {![string equal -nocase $chan "$::chanopschan"] || [string first "#" $enforcechan] == -1} { return 0 }

   if {[isop $nick $::chanopschan] || [ishalfop $nick $::chanopschan] || [matchattr $hand o|o $::chanopschan]} {  
   if {[botisop $enforcechan] && [ishalfop $nick $enforcechan] && [onchan $nick $enforcechan] && [onchan $::botnick $enforcechan]} { pushmode $enforcechan -h $nick }
   }
  }
}   
   
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

thank you so much
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

i tried that , but when do !op #chan-name there is no action = not op chanop
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

ok i changed :

Code: Select all

set chanopschan "#chanops"

bind pub -|- !op Pub:OP:monotor-channel
to :

Code: Select all

set chanopschan "#chanops"

bind pub o|- !op Pub:OP:monotor-channel
also changed :

Code: Select all

if {[botisop $enforcechan] && ![isop $nick $enforcechan] && [onchan $nick $enforcechan] && [onchan $::botnick $enforcechan]} { pushmode $enforcechan +o $nick }
   }
  }
}   
to :

Code: Select all

if {[botisop $enforcechan] && ![isop $nick $enforcechan] && [onchan $nick $enforcechan] && [onchan $::botnick $enforcechan]} { pushmode $enforcechan +o $nick }
   }
  }
now working fine
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I think it's safe to remove the [onchan $nick $enforcechan] && [onchan $::botnick $enforcechan] part as the previous two checks validate them as well, meaning botisop can't return true unless bot is on the channel and the isop can't return true if nick isn't on the channel.

You set the chan to be lower case via:

Code: Select all

set chan [string tolower $chan]
and then in:

Code: Select all

if {![string equal -nocase $chan "$::chanopschan"] || [string first "#" $enforcechan] == -1} { return 0 } 
use the -nocase that ignores the case, so the above is pointless.

I would consider moving the [botisop $enforcechan] higher in the code and return if it's false, else continue with the rest of the code.
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1080
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thanks caesar

Code: Select all


bind pub -|- !op Pub:OP:monotor-channel

proc Pub:OP:monotor-channel {nick host hand chan text} {
  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
  set items [split $text]
  if {[llength $items] < 1 } { putnow "notice $nick :Syntax is !op \#chan" ; return }
  set enforcechan [lindex [split $text] 0]
  if {![string equal -nocase $chan "$::chanopschan"] || [string first "#" $enforcechan] == -1 || ![botisop $enforcechan] || [isop $nick $enforcechan]} { return 0 }
  if {[isop $nick $::chanopschan] || [ishalfop $nick $::chanopschan] || [matchattr $hand o|o $::chanopschan]} {  pushmode $enforcechan +o $nick }
}   

User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

You might want to check your last if statements cos something doesn't feel right in there.
Once the game is over, the king and the pawn go back in the same box.
User avatar
CrazyCat
Revered One
Posts: 1237
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

I think you make that too complex:

Code: Select all

if {![string equal -nocase $chan "$::chanopschan"] || [string first "#" $enforcechan] == -1 || ![botisop $enforcechan] || [isop $nick $enforcechan]}
Why don't simply test:

Code: Select all

if {![validchan $enforcechan] || ![string tolower $enforcechan] eq $::chanopschan || ![botisop $enforcechan]}
You don't really care if user is already op, and validchan is a better way to check if chan exists and bot knows it.
Last edited by CrazyCat on Tue Sep 19, 2023 6:38 pm, edited 1 time in total.
s
simo
Revered One
Posts: 1080
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Makes sense thanks Crazy Cat and caesar
Post Reply