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 

Reop-Mode

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


Joined: 24 Oct 2008
Posts: 37

PostPosted: Sun Feb 27, 2022 11:20 am    Post subject: Reop-Mode Reply with quote

hi,
I would like a script that implements the following feature: HERE


something like:
Quote:
<nick> !reop
<bot> Channel Reop List:
<bot> *!xxx@bla.bla.org
<bot> *!yyy@vhost.net
<bot> *!*@4.3.2.1

<nick> !+reop *!*@2001:67c:0:0:0:0:0:2 *!*@1.2.3.4
<bot> MODE #channel +R *!*@2001:67c:0:0:0:0:0:2
<bot> MODE #channel +R *!*@1.2.3.4
<bot> User(s) added to Reop List

<nick> !-reop *!xxx@bla.bla.org *!*@1.2.3.4
<bot> MODE #channel -R *!xxx@bla.bla.org
<bot> MODE #channel -R *!*@1.2.3.4
<bot> User(s) removed from Reop List


can you help me?
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1169

PostPosted: Sun Feb 27, 2022 12:41 pm    Post subject: Re: Reop-Mode Reply with quote

It appears that this server mode acts only if there are no ops in the channel.
( We can't duplicate that with an Eggdrop, as the bot itself must still be op'd, for it to be able to op anyone else. )

I'm wondering if we are going to re-invent the wheel here. Smile
Is the built-in "+o" flag good enough?

You can add users to the bot. You can make their hostmask as tight as you wish, even including nick.
Give them the +o flag, globally or on a channel specific basis.

Then, at any time in the future, then can send a /msg to the bot, and have the bot re-op them. Of course, this assumes that the bot itself is still op'd.
Or, you could give them the +a flag too, and bot would auto-op them.

Maybe I'm missing something here....
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 771
Location: Tennessee, USA

PostPosted: Sun Feb 27, 2022 12:52 pm    Post subject: Reply with quote

Not sure I get the reasoning.

Why would you not just use the IRCnet MODE commands directly??
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
geek
Voice


Joined: 24 Oct 2008
Posts: 37

PostPosted: Sun Feb 27, 2022 1:27 pm    Post subject: Reply with quote

@willyw
and
@SpiKe^^


I know eggdrop features very well, built-in flags, etc.

ircnet is "old style", so no Services at all
if you only have a couple of eggdrops with op and you want to have all other users just with +v, it's not impossible for the channel to become opless

Reop-Mode was introduced for this reason

I could give "MODE R" commands manually, but I would like to do it without the op and with !trigger

so I asked for this script
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 771
Location: Tennessee, USA

PostPosted: Sun Feb 27, 2022 2:30 pm    Post subject: Reply with quote

k.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Sun Feb 27, 2022 6:41 pm    Post subject: Reply with quote

altho i agree with willyw eggdrop needs to be opped to set anymode i came up with this took this from a cleanbans thread from forum here i dont remember from wich thread tho:

try this if it does the job:

Code:

# Re-Op-Mode.tcl #

set reop(max) 10

bind pub - !reop Reop:chan


proc Reop:chan {nick uhost hand chan text} {
  global reop
 
  if {![isop $nick $chan] && ![matchattr $hand o|o $chan]} { return 0 }

 
   if {![botisop $chan]} return
 
  set reop($chan) [list 0]
 
  set reopnick $nick
 
  bind raw - 344 cb:bind:raw
  bind raw - 345 cb:bind:raw

  putserv "MODE $chan R"
  return 0
}





proc cb:bind:raw {from key text} {
  global reop
  lassign [split $text] not chan mask

  if {![info exists reop($chan)]} {  return 0  }

  set masks [lassign $reop($chan) total]

  if {$key == 344} {
    lappend masks $mask  ;  incr total
  }

  set cnt [llength $masks]
  if {$total == 0} {
    puthelp "Notice $::reopnick :$chan ReOp list is empty"
  } elseif {$cnt == $reop(max) || ($cnt > 0 && $key==345)} {
    set mode [string repeat "R" $cnt]
    putserv "Notice $::reopnick [join $masks]"

    set reop($chan) [list $total]
  } else {
    set reop($chan) [linsert $masks 0 $total]
  }

  if {$key == 345} {
    unset reop($chan)
    unbind raw - 344 cb:bind:raw
    unbind raw - 345 cb:bind:raw
    puthelp "Notice $::reopnick :$total ReOp entries on $chan"
  }

  return 1
}




bind pub -|- !reopmode pub:reopmode

proc  pub:reopmode {nick uhost hand chan text} {
            if {![isop $nick $chan] && ![matchattr $hand o|o $chan]} { return 0 }

          set reopmsk [list]



   foreach entries [split $text]  { lappend reopmsk $reopmask }

      if {[info exists entries]} { reopmodes $chan $entries }
}




 proc reopmodes {chan reoplist {max 3}} {
      set count [llength $reoplist]
      while {$count > 0} {
         if {$count> $max} {
            set mode [string repeat "R" $max]
            set masks [join [lrange $reoplist 0 [expr {$max - 1}]]]
            set reoplist [lrange $reoplist $max end]
            incr count -$max
            incr total $max
         } else {
            set mode [string repeat "R" $count]
            set masks [join $reoplist]
            incr total $count
            set count 0
         }
         puthelp "MODE $chan +$mode $masks"
      }
   }







i checked the servers max mode settings per line and it returned 3 mode settings per line wich is why i used 3 in the mode stacker reopmodes
the reason i didnt use pushmode is because i wasnt sure if channel mode +R nick!ident@host is recognized by built in pushmode modes
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Sun Feb 27, 2022 9:11 pm    Post subject: Reply with quote

i tested this and it seems to work well except it doesnt stack the reop access list in a single line as much as possible instead it sends each in seperate notice spamming the nick requesting the list

Code:

# Re-Op-Mode.tcl #

set reop(max) 10

bind pub - !reoplist Reoplist:chan

proc Reoplist:chan {nick uhost hand chan text} {
  global reop reopnick

  if {![isop $nick $chan] && ![matchattr $hand o|o $chan]} { return 0 }

    if {![botisop $chan]} return
 
  set reop($chan) [list 0]
 
  set reopnick $nick
 
  bind raw - 344 cb:bind:reop
  bind raw - 345 cb:bind:reop

  putserv "MODE $chan R"
  return 0
}


proc cb:bind:reop {from key text} {
  global reop reopnick
  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
  set text [split $text]

   lassign [split $text] not chan mask

   if {![info exists reop($chan)]} {  return 0  }

  set masks [lassign $reop($chan) total]



  if {$key == 344} {
   lappend masks $mask  ;  incr total
  }

  set cnt [llength $masks]
  if {$total == 0} {
    puthelp "Notice $reopnick :$chan ReOp list is empty"
  } elseif {$cnt == $reop(max) || ($cnt > 0 && $key==344)} {

    puthelp "Notice $reopnick :[join $masks]"

    set reop($chan) [list $total]
  } else {
    set reop($chan) [linsert $masks 0 $total]
  }

  if {$key == 345} {
    unset reop($chan)
    unbind raw - 344 cb:bind:reop
    unbind raw - 345 cb:bind:reop
    puthelp "Notice $reopnick :$total ReOp entries on $chan"
  }

  return 1
}



 




bind pub -|- !addreop pub:addreopmode

proc  pub:addreopmode {nick uhost hand chan text} {
            if {![isop $nick $chan] && ![matchattr $hand o|o $chan]} { return 0 }

          set reopmsk [list]

           foreach entries [split $text]  { lappend reopmsk $entries }

      if {[info exists reopmsk]} { reopmodes $chan $reopmsk }
}




 proc reopmodes {chan reoplist {max 3}} {
      set count [llength $reoplist]
      while {$count > 0} {
         if {$count> $max} {
            set mode [string repeat "R" $max]
            set masks [join [lrange $reoplist 0 [expr {$max - 1}]]]
            set reoplist [lrange $reoplist $max end]
            incr count -$max
            incr total $max
         } else {
            set mode [string repeat "R" $count]
            set masks [join $reoplist]
            incr total $count
            set count 0
         }
         puthelp "MODE $chan +$mode $masks"
      }
   }


 


Last edited by simo on Sun Feb 27, 2022 10:19 pm; edited 4 times in total
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Sun Feb 27, 2022 9:39 pm    Post subject: Reply with quote

the output of:

/mode #channel R

is:
Quote:

[02:36:20][IRCnet] -> irc.nlnog.net MODE #channel R
[02:36:20][IRCnet] <- :irc.nlnog.net 344 botnick #channel *!*@All4Masti-4n8.556.33.95.IP
[02:36:20][IRCnet] <- :irc.nlnog.net 344 botnick #channel *!*@All4Masti-y0k.138.69.30.IP
[02:36:20][IRCnet] <- :irc.nlnog.net 344 botnick #channel *!*@All4Masti-in6.676.89.60.IP
[02:36:20][IRCnet] <- :irc.nlnog.net 344 botnick #channel *!*@All4Masti-x0a.532.56.04.IP
[02:36:20][IRCnet] <- :irc.nlnog.net 344 botnick #channel *!*@All4Masti-u93.803.38.49.IP
[02:36:20][IRCnet] <- :irc.nlnog.net 345 botnick #channel :End of Channel Reop List
Back to top
View user's profile Send private message
geek
Voice


Joined: 24 Oct 2008
Posts: 37

PostPosted: Mon Feb 28, 2022 7:05 am    Post subject: Reply with quote

thanks for your script simo

now I have to work, I'll test it this evening
Back to top
View user's profile Send private message
geek
Voice


Joined: 24 Oct 2008
Posts: 37

PostPosted: Mon Feb 28, 2022 2:40 pm    Post subject: Reply with quote

works very well

only a strange behavior:
I disable this script with # in .conf
I .rehash the eggdrop
!commands still work Shocked

in any case, thanks simo!

are you on ircnet too?
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Mon Feb 28, 2022 4:26 pm    Post subject: Reply with quote

yes im on #nespresso
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Mon Feb 28, 2022 4:59 pm    Post subject: Reply with quote

Code:

# ReOp-Mode.tcl #

set reop(max) 10

bind pub - !reoplist Reoplist:chan


proc Reoplist:chan {nick uhost hand chan text} {
  global reop reopnick

  if {![isop $nick $chan] && ![matchattr $hand o|o $chan]} { return 0 }

 
   if {![botisop $chan]} return
 
  set reop($chan) [list 0]
 
  set reopnick $nick
 

  bind raw - 344 cb:bind:reop
  bind raw - 345 cb:bind:reop

  putserv "MODE $chan R"
  return 0
}





proc cb:bind:reop {from key text} {
  global reop reopnick
  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
  set text [split $text]

   lassign [split $text] not chan mask

   if {![info exists reop($chan)]} {  return 0  }

  set masks [lassign $reop($chan) total]



  if {$key == 344} {
   lappend masks $mask  ;  incr total
  }

  set cnt [llength $masks]
  if {$total == 0} {
    putnow "Notice $reopnick :$chan ReOp list is empty"
  } elseif {$cnt == $reop(max) || ($cnt > 0 && $key==344)} {

    putnow "Notice $reopnick :[join $masks]"

    set reop($chan) [list $total]
  } else {
    set reop($chan) [linsert $masks 0 $total]
  }

  if {$key == 345} {
    unset reop($chan)
    unbind raw - 344 cb:bind:reop
    unbind raw - 345 cb:bind:reop
    puthelp "Notice $reopnick :$total ReOp entries on $chan"
  }

  return 1
}





bind pubm - "#% !+reop*" pub:addreopmode
bind pubm - "#% !-reop*" pub:addreopmode


proc pub:addreopmode {nick host hand chan text} {
            if {![isop $nick $chan] && ![matchattr $hand o|o $chan]} { return 0 }
            set text [stripcodes * $text]
            set text [split $text]
             set restmodes [lrange [split $text] 1 end]
             if {[string match -nocase "!+reop*" [stripcodes * $text]]} {
           if {![isop $nick $chan] && ![matchattr $hand o|o $chan]} { return 0 }
          set reopmsk [list]
           foreach entries [split $restmodes]  { lappend reopmsk $entries }
      if {[info exists reopmsk]} { reopmodes $chan + $reopmsk }
}

             if {[string match -nocase "!-reop*" [stripcodes * $text]]} {
         if {![isop $nick $chan] && ![matchattr $hand o|o $chan]} { return 0 }
          set reopmsk [list]
           foreach entries [split $restmodes]  { lappend reopmsk $entries }
      if {[info exists reopmsk]} { reopmodes  $chan - $reopmsk }
}

}

proc reopmodes {chan prefix reoplist {max 3}} {
      set count [llength $reoplist]
      while {$count > 0} {
         if {$count> $max} {
            set mode [string repeat "R" $max]
            set masks [join [lrange $reoplist 0 [expr {$max - 1}]]]
            set reoplist [lrange $reoplist $max end]
            incr count -$max
            incr total $max
         } else {
            set mode [string repeat "R" $count]
            set masks [join $reoplist]
            incr total $count
            set count 0
         }
         puthelp "MODE $chan $prefix$mode $masks"
      }
   }


i hope someone can fix the display of reop list in 1 line as much as possible to prevent the bot to get disconnected due to excess messages sent

its weird why this doesnt get all the entries to stack in stacks of 10 in a line

Quote:


if {$key == 344} {
lappend masks $mask ; incr total
}
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