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.

How to deop/devoice users that do not have +o/+v

Old posts that have not been replied to for several years.
H
Hypergrip

Post by Hypergrip »

Hi there.
I need to write a script that allows only registered users with +o/+v to get op/voice.
If an Op sets mode +o or +v to another user that does not have the +o pr +v flag, the bot should deop / devoice the user.
I don't think this is too difficult, but i just don't have the time to read all the TCL-Manual (i've got final exams in two weeks).

Thanx

Hypergrip
User avatar
DrTongue
Op
Posts: 115
Joined: Sat Jan 26, 2002 8:00 pm
Location: Orlando, Florida
Contact:

Post by DrTongue »

Well I can not write you the .tcl you requested. Some of the experts here may do that for you. An alternative is that there are already several (I believe).tcl scripts on this site in the .tcl directory that will allow only BOTS to op users, no one not even users can op others....hence only registered users get ops. :smile:
H
Hypergrip

Post by Hypergrip »

well the protection from "normal" users getting ops is no problem... that's what eggdrop's Bitch-Mode is for :wink:
The script should be something like "voice-bitch-mode".
the structure is no problem for me, but i do bad understanding TCL-Syntax :sad:

hypergrip
t
tainted
Master
Posts: 239
Joined: Sun May 12, 2002 8:00 pm
Location: chicago
Contact:

Post by tainted »

Now's a good time to sharpen up on it! If you know the structure, you are halfway there. Try downloading a bitch-mode tcl even, and read that and see how it works, even use it for referance while writing yours. Just please oh please dont copy the procs and change a few vars and call it yours. :razz:
H
Hypergrip

Post by Hypergrip »

I just stumbles over a guy who helped me a bit writing this script, but although the structure seems to be ok, the bot does NOT react on modechanges :sad:
Perhaps one of ouy caan figure out, why it's not running.
here's the script:

# Bitch+ V1.3 by Hypergrip & thommey
# (=- teamwork roxx -=)
#
# Use ".chanset #channel +voicebitch" or +opbitch to enable this script
#
#####################################################################

bind mode - +v voicebitch

setudef flag voicebitch

proc voicebitch {nick uhost handle chan change victim} {
if {[lsearch [channel info $chan] "+voicebitch"] == -1} {
return 0
}

set i [nick2hand $nick]
if {[matchattr $i |m $chan]} {
return 0
}

set h [nick2hand $victim]
if {$h == *} {
pushmode $chan -v $victim
} else {
if {![matchattr $victim |v $chan]} {
pushmode $chan -v $victim
}
}
putlog "user $nick was devoiced because of missing flag"
}

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

bind mode - +o opbitch

setudef flag opbitch

proc opbitch {nick uhost handle chan change victim} {
if {[lsearch [channel info $chan] "+opbitch"] == -1} {
return 0
}

set i [nick2hand $nick]
if {[matchattr $i |m $chan]} {
return 0
}

set h [nick2hand $victim]
if {$h == *} {
pushmode $chan -o $victim
} else {
if {![matchattr $victim |o $chan]} {
pushmode $chan -o $victim
}
}
putlog "user $nick was deopped because of missing flag"
}

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

putlog "Bitch+ V1.3 by Hypergrip & thommey - Loaded"
t
tainted
Master
Posts: 239
Joined: Sun May 12, 2002 8:00 pm
Location: chicago
Contact:

Post by tainted »

try binding *+v instead of just +v. I'm not 100% sure on that, but after a .binds mode, and a quick test, it seems to work.

..[blah(dcc)] Command bindings:
..[blah(dcc)] TYPE FLGS COMMAND HITS BINDING (TCL)
..[blah(dcc)] mode -|- *+v 2
..[blah(dcc)] mode -|- +v 0
H
Hypergrip

Post by Hypergrip »

Thanx, this was one of the two errors in the script.
the second one was that the line
if {$h == *}
has to be
if {$h == "*"}
now it works just fine.

But i want to improve the script so that the bot himself may op or voice users.
At the current state this is not possible, cause the bot has now flags (or can her have flags ???)
Is there a away to check if $nick is the bot himself ?

Thanx

Hyper
H
Hypergrip

Post by Hypergrip »

argh !
Problems again !

the channel is auto-voice.
If an user with +v joins the channel, the bot gives him voice.
so far, so good.
BUT now the voice-bitch-script gevoices the user (WHY THE HELL ?!?) and the we get a channel full of +v -v +v -v +v -v and so on
d'oh.

Any idea where the error might be ?

Hypergrip
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

On 2002-06-18 08:18, Hypergrip wrote:
argh !
Problems again !
[snip]
Hi Hypergrip. There are some problems in the scripts you presented.

1. You must check that $nick giving ops/voice == $botnick

2. You must check that the $victim receiving the ops/voice == $botnick

3. You may carefully recheck what your snippet of code is doing:

Code: Select all

set h [nick2hand $victim] 
if {$h == *} { 
   pushmode $chan -v $victim 
} else { 
   if {![matchattr $victim |v $chan]} { 
      pushmode $chan -v $victim 
   } 
}
First you check for the existence of the handle and then you check for the existence of a flag on a nick, not on a handle.

4. You may take care of a situation where a user does: +vvv nick nick nick. Your script will trigger on each of these mode changes.

5. You may check that actually [botisop $chan]

You can check out:

http://forum.egghelp.org/viewtopic.php? ... 90&forum=2

and

http://members.fortunecity.com/eggheadt ... op.tcl.txt

<font size=-1>[ This Message was edited by: egghead on 2002-06-18 08:54 ]</font>
H
Hypergrip

Post by Hypergrip »

Thanx, this was a lot of help to me :smile:
Sometimes i'm just too blind to see such easy errors :wink:

1.) Ok, will be in the next version of the script

2.) Hmm... The bot will deop himself when he's given op. That's one thing I would not have regognised until it would have been too late :wink:

3.) As i said... sometimes i'm just too blind to see such easy mistakes. Thanks for your hint.

4.) I thought a "mass-voice" would automatically broken up into many +v modechanges. Tests with the "buggy" version of this script showed, that the bot reacted to a +vvv with a -vvv. Can anyone back me up with some background information on this ?

5.) Sure. This was actually planned as next step after solving the "main" problems :smile:

Thanx a lot for your help !!

Greetz

Hyper
t
tainted
Master
Posts: 239
Joined: Sun May 12, 2002 8:00 pm
Location: chicago
Contact:

Post by tainted »

I didnt put the script on a bot, but by just glancing through it.. why wouldn't the bot respond to a +vvv with a -vvv? Same would go for a +vov user1 user2 user2 I believe, which by all means is correct. If its voicing the same user, like +vvv user1 user1 user1, then I bet you could compare the three users and if they are the same then just put out one -v mode, and send a bit less data. *shrug*
H
Hypergrip

Post by Hypergrip »

Tcl error [opbitch]: can't read "botnick": no such variable

Uhm.. where was the current nick of the bot stored in again ? :smile:
t
tainted
Master
Posts: 239
Joined: Sun May 12, 2002 8:00 pm
Location: chicago
Contact:

Post by tainted »

$botnick
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

On 2002-06-19 16:28, tainted wrote:
I didnt put the script on a bot, but by just glancing through it.. why wouldn't the bot respond to a +vvv with a -vvv? Same would go for a +vov user1 user2 user2 I believe, which by all means is correct. If its voicing the same user, like +vvv user1 user1 user1, then I bet you could compare the three users and if they are the same then just put out one -v mode, and send a bit less data. *shrug*
Tainted, the point is that in case of e.g. opping, the script may respond to a "+oooooo nick nick nick nick nick nick" with a "-oooooo nick nick nick nick nick nick" or even 6 seperate lines with a -o. Or, to deop both the nick handing out the +o and the nick receiving it, with 6 lines -oo.
But worse, the irc server penalizes the bot for it. You may test yourself if and when eggdrop's queuing system removes the extraneous modes.
But, if you think it is correct and *shrug* about it, then nevermind. *shrug*
H
Hypergrip

Post by Hypergrip »

Hmm... i don't think my english is too bad, but I still don't get the point:
What's bad if the Bot reacts to a +oooo with a -oooo ?
I mean... is't this what this script is for ? :wink:
And why should the server penalize the bot ? for mode-flood ?
(the bot devoiced 13 users in 4 lines and was not penalized)

Greetz

Hypergrip
Locked