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.

kreynet need op

Old posts that have not been replied to for several years.
C
CosmicD
Op
Posts: 102
Joined: Sat Dec 11, 2004 3:46 pm

kreynet need op

Post by CosmicD »

I've a litle script that logs the bot in with the KreyNet chanserv, but I'd like a script that, when the bot looses its ops there it asks /msg chanserv op $channelname ,

anyone can do that ?
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

bind mode - "* -o" check:mode
proc check:mode {n ho ha ch mc who} {
	if {[string equal -nocase $::botnick $who]} { putserv "PRIVMSG chanserv :op $ch" }
}
this should do it
Elen sila lúmenn' omentielvo
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

why not use need-op?
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

arcane wrote:why not use need-op?
because it would require periodical set, in case channels are being added dynamically:

Code: Select all

bind time - * {foreach c [channels] {channel set need-op {putserv "privmsg chanserv :op $c"}};#}
Papillon's version will not work when bot loses ops due to kick/quit/reconnect; here's one that will always work:

Code: Select all

bind need - "% op" foo
proc foo {c t} {putserv "privmsg chanserv :op $c"}
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Simple, solution.

Bind to "mode". Then check if [string equal $mode "-o"] and [string equal -nocase $target $botnick] and ![string equal -nocase $nick $botnick] and ![isop $botnick $chan]. If all match then go ahead and putserv "PRIVMSG ChanServ :OP $chan". That should be about it.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

awyeah wrote:Simple, solution.

Bind to "mode". Then check if [string equal $mode "-o"] and [string equal -nocase $target $botnick] and ![string equal -nocase $nick $botnick] and ![isop $botnick $chan]. If all match then go ahead and putserv "PRIVMSG ChanServ :OP $chan". That should be about it.
that's exactly Papillon's version, with unnecessary additional checks
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

isbotnick $who should do it too? :wink:
Once the game is over, the king and the pawn go back in the same box.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Any of these two will do the same job. It's just a persons preference both of which he considers his favourite:

[string equal -nocase $botnick $target]
[isbotnick $target]
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
C
CosmicD
Op
Posts: 102
Joined: Sat Dec 11, 2004 3:46 pm

Post by CosmicD »

ah,

well I used the first one , but what happens is that my bot is deopped on one channel befor i rehashed, then I've deopped it myself on a channel i'm operator on and it seems to work if it actually detects a mode change..

anyway when it would script, the first part of the K script would log it in and op it automaticly because chanserv does that on login and on join,

the problem now is, it doesn't seem to be aware that it's deopped.... its just aware when you deop it ....

how can I solve that ? (thanks for the help already)
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I don't fully understand what you are trying to say. Could you paste your actual code over here, the one which you use so we can take a look.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
C
CosmicD
Op
Posts: 102
Joined: Sat Dec 11, 2004 3:46 pm

Post by CosmicD »

This is the "entire" kreynet chanserv (K) script that I have now withlogin routine also + added code from this thread,

Code: Select all

set regnick "chanservnickofbot"
set password "chanservpassforbot"

set init-server {putserv "PRIVMSG K :LOGIN $regnick $password"}

#---- keep ops section received from egghelp.org forum ------

bind mode - "* -o" check:mode
proc check:mode {n ho ha ch mc who} {
   if {[string equal -nocase $::botnick $who]} { putserv "PRIVMSG K :op $ch" }
}
so the situation:

lets say the bot has an @ on #a and not on #b. when I get to channel #a , and test this script, the bot will automaticly regain ops set by the script. but the bot was on channel #b and already deopped when I put the code in the sepparate chanserv tcl file that I have set for it to load.

Now, the bot doesn't seem to know that it is deopped on channel #b.... thus, the script doesn't make it awware that it is "deopped" only when you actively deop it when it has ops.. Hope i make myself clearer now
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

did you read demond's post?
Have you ever read "The Manual"?
C
CosmicD
Op
Posts: 102
Joined: Sat Dec 11, 2004 3:46 pm

Post by CosmicD »

ah yeah, the foo proc thingy worked, thx,

i guess it can work together with the other procedure because it would immediately op the bot again....

So, for archiving purposes, if someone needs this on Kreynet:
+ added invite functionally for the bot tp become immortal :P

Code: Select all

set regnick "chanservnickofbot" 
set password "chanservpassforbot" 

set init-server {putserv "PRIVMSG K :LOGIN $regnick $password"} 

bind mode - "* -o" check:mode 
proc check:mode {n ho ha ch mc who} { 
   if {[string equal -nocase $::botnick $who]} { putserv "PRIVMSG K :op $ch" } 
} 
bind need - "% op" foo
proc foo {c t} {putserv "privmsg K :op $c"}

bind need - "% invite" blah
proc blah {c t} {putserv "privmsg K :invite $c"}
, thx all :)
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You can make a simple timer to execute as well, to check say every 5 mins if the bot is opped on the channel or not.

The 'need-op' one floods services alot, and I got my bot killed alot of times, since it is very rapid, unless you use a timer delay.

Code: Select all

#Set channels to check ops on
set opchans "#chan1 #chan2 #chan3"

#Set the time in minutes to check if the bot is opped on each channel
set opchecktime "5"

timer $opchecktime check:ops

proc check:ops { } {
 global opchecktime opchans
  foreach c $opchans {
   if {![botisop $c]} {
    putquick "PRIVMSG K :OP $c" -next
    }
   }
 timer $opchecktime check:ops
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
C
CosmicD
Op
Posts: 102
Joined: Sat Dec 11, 2004 3:46 pm

Post by CosmicD »

hmm, do you mean that need ops "always" continues to send requests to services ? also if it has ops ? (normally I would see that because whenever you ask ops you actually see the serice op the bot even if it is having an op)...
Locked