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.

to raise ops in any room where the bot is

Help for those learning Tcl or writing their own scripts.
User avatar
flink
Halfop
Posts: 83
Joined: Sun Feb 21, 2021 9:27 am
Location: Canarias

Post by flink »

Hello CrazyCat, thanks for answering, I thought it was understood, since I return to the topic of something you requested at the time and SpiKe^^ created me and let it work and now I have the problem that you say that it does not recognize when I use the nickcompletion anywhere from the phrase that is the help I request, even so I paste the code and what happens to me when I try to op some user in a room where the bot is @ thanks again.

Code: Select all

#  remoteOp ver. 0.1  #

###  for example: !op #radio pepe, thanks  ###
###  or: !op #springfield bart lisa homer  ###


set adminChan "#admin"  ;# !!! Set a single admin channel !!! #

###############################

bind pub n !op pub_remote_op

proc pub_remote_op {nick uhost hand chan text} {
  if {![string equal -nocase $chan $::adminChan]} {  return 0  }

  set wholist [lassign [split [string trim $text]] where]
  if {![llength $wholist] || ![validchan $where]} {
    putserv "PRIVMSG $chan :Command syntax:  \002!op #validchannel nick(s)\002"
    return 1
  }
  if {![botisop $where]} {
    putserv "PRIVMSG $chan :I'm not op'd in ${where}. I need to be op'd to do that."
    return 1
  }

  foreach nk $wholist {
    if {[isbotnick $nk]} {  set self 1
    } elseif {![onchan $nk $where]} {  lappend gone $nk
    } elseif {[isop $nk $where]} {  lappend iso $nk
    } else {  lappend ok $nk  }
  }

  if {[info exists self]} {  putserv "PRIVMSG $chan :I can't op myself:)."  }

  if {[info exists gone]} {
    putserv "PRIVMSG $chan :Not found in ${where}:  \002[join $gone]\002"
  }
  if {[info exists iso]} {
    putserv "PRIVMSG $chan :Already op'd in ${where}:  \002[join $iso]\002"
  }

  if {[info exists ok]} {
    set mode [string repeat "o" [llength $ok]]
    putserv "MODE $where +$mode [set ok [join $ok]]"
    putserv "PRIVMSG $chan :Op'd \002${ok}\002 in ${where}."
    putlog "$nick made me op $ok in ${where}."
  }

  return 1
}
#End of pub_remote_op
  • @canario- ¦ !op #ChiCharrEroS 12[ 10- 11- 3> 12n 12I 12k 12s 3< 11- 10- 12]
    radioangelcaido(RAcaidos@la.música.es.ese.lugar.en.el.que.todos. coincidemos.alguna.vez)- No se encuentra en #ChiCharrEroS: 12[ 10- 11- 3> 12n 12I 12k 12s 3< 11- 10- 12]
Mi ingles: no es el mejor, Manda el traductor... :)
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

The trouble doesn't come from the script but your autocompletion adds weird codes (colors ?)
Change the way it works. I don't know which irc client you use, but this one must be trashed quick :)
User avatar
flink
Halfop
Posts: 83
Joined: Sun Feb 21, 2021 9:27 am
Location: Canarias

Post by flink »

Thanks for answering CrazyCat, I thought there was a way in which the bot would pay attention when we write in colors, in this case it's a nickcomletion addons that write it anywhere in the sentence, the answer doesn't solve my question, thanks anyway for participation. I stay in the same situation with the one that entered does not work in colors :)
Mi ingles: no es el mejor, Manda el traductor... :)
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

flink

I might try to help if I had any idea what you were talking about:)
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

try this it strips color codes from text but if your nickcompleter adds additional characters it wont work its not clear to me what real nickname you tried to op

Code: Select all


#  remoteOp ver. 0.1  #

###  for example: !op #radio pepe, thanks  ###
###  or: !op #springfield bart lisa homer  ###


set adminChan "#admin"  ;# !!! Set a single admin channel !!! #

###############################

bind pub n !xor Xpub_remote_opX

proc Xpub_remote_opX {nick uhost hand chan text} {
  if {![string equal -nocase $chan $::adminChan]} {  return 0  }

  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]

  set wholist [lassign [split [string trim $text]] where]
  if {![llength $wholist] || ![validchan $where]} {
    putserv "PRIVMSG $chan :Command syntax:  \002!op #validchannel nick(s)\002"
   return 1
  }
  if {![botisop $where]} {
    putserv "PRIVMSG $chan :I'm not op'd in ${where}. I need to be op'd to do that."
    return 1
  }

  foreach nk $wholist {
    if {[isbotnick $nk]} {  set self 1
    } elseif {![onchan $nk $where]} {  lappend gone $nk
    } elseif {[isop $nk $where]} {  lappend iso $nk
    } else {  lappend ok $nk  }
  }

  if {[info exists self]} {  putserv "PRIVMSG $chan :I can't op myself:)."  }

  if {[info exists gone]} {
    putserv "PRIVMSG $chan :Not found in ${where}:  \002[join $gone]\002"
  }
  if {[info exists iso]} {
    putserv "PRIVMSG $chan :Already op'd in ${where}:  \002[join $iso]\002"
  }

  if {[info exists ok]} {
    set mode [string repeat "o" [llength $ok]]
    putserv "MODE $where +$mode [set ok [join $ok]]"
    putserv "PRIVMSG $chan :Op'd \002${ok}\002 in ${where}."
    putlog "$nick made me op $ok in ${where}."
  }

  return 1
}
#End of pub_remote_op

s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

perhaps you could give examples of nick with nickcompleter and the actual real nick
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Looks like he tested with [-->nIcks<--]
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

oh ok then i have to agree with you CrazyCat such nick completer script shouldnt be used or edited to use actual nicks when using !commands
wich i use as well

for example for mirc :

Code: Select all


ON *:INPUT:#: { 
  if ($left($1,1) == /) || ($ctrlenter)  return 
    if ($left($1,1) == !) {  say  $1-  | halt  } 
  say  $regsubex($1-,/([\w-_`^\\\[\]\{\}|]+)/g,$iif(\1 $iif(\1 == $target,iswm,ison) $target,$+($chr(3),$base($gettok(00 08 09 11 15,$r(1,5),32),10,10,2),$chr(44),$base($gettok(1 2 3 5 6 10 12 14,$r(1,8),32),10,10,2),$chr(32)) $theme2011($pn2011(\1, $chan)) $chr(32)  , \1)))
  halt
}

ALIAS theme2011 { return $1 }
ALIAS -l pn2011 {
  if ($len($nick($2,$1).pnick) != $len($1)) {
    var %nick $+($left($nick($2,$1).pnick,1),$1)
    return  %nick
  }
  else return $nick 
}


Last edited by simo on Wed Dec 14, 2022 12:54 pm, edited 2 times in total.
User avatar
flink
Halfop
Posts: 83
Joined: Sun Feb 21, 2021 9:27 am
Location: Canarias

Post by flink »

Hello again, the nick without color would be this: [-->nIks<--] and when the nickcompletion colors it, it would be like this: 12[10-11-3>02n02I02k02s3<11-10-12]
Mi ingles: no es el mejor, Manda el traductor... :)
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

if u use mirc my above example code should work fine
User avatar
flink
Halfop
Posts: 83
Joined: Sun Feb 21, 2021 9:27 am
Location: Canarias

Post by flink »

Good Simo, yes apparently adding to the code

Code: Select all

set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
It does recognize colors, but the ones eggdrop doesn't recognize are characters such as \\\[\]\{\} etc. The contribution of the second code for the mIrc would be the same as deactivating the nickcompletion addons, the idea that the same code for the mIrc would be put in the eggdrop so that it could read them.Thanks again for the contribution
Mi ingles: no es el mejor, Manda el traductor... :)
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

that will over complicate stuff as u add characters to nicks and then want eggdrop to strip all extra added characters while they can be part of a nick
its best to fix this on client level

im not sure what client you are using else i could edit it to send actuall nicks when using !commands and else output with nick completer
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

and the mirc code i posted doesnt disable nickcompleter totally it only does when using !commands
User avatar
flink
Halfop
Posts: 83
Joined: Sun Feb 21, 2021 9:27 am
Location: Canarias

Post by flink »

I understand, I'll remove the characters from l nickcompletion and I'll just leave the colors since the eggdrop reads them perfectly and finished sooner and so I don't complicate your life with questions :) thanks again for the help.
PD: hi SpiKe^^ sorry for not greeting you friend :)
Mi ingles: no es el mejor, Manda el traductor... :)
Post Reply