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.

When eggdrop has no op on channel

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
d
dhalus
Voice
Posts: 1
Joined: Tue Jan 10, 2012 12:33 am

When eggdrop has no op on channel

Post by dhalus »

When eggdrop has no op on channel,to take op with command /opmode #channel +o nick.
I have a irc server, and i have an eggdrop caled help.. is the best eggdrop but is missing one of best part ... i wanna the eggdrop to take autoop on channel with oper,if some one try to deop him to give kill!! with command /kill nick to lazy! to the client. thank you who can help me with tcl script 8) 8) 8) :)
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

I didn't test this, but it sounds like something you want.

Code: Select all

# Auto TCL - istok @ IRCSpeed.org
# $Id: auto.tcl,v1 20/01/2012 04:37:42am GMT +12 (NZST) istok Exp $

bind join - * join:op
proc join:op {nick uhost hand chan} {
  if {![isbotnick $nick]} {return}
  utimer 5 check:status
}

proc check:status {} {
  global botnick
  foreach chan [channels] {
    if {![isop $botnick $chan]} {
    putquick "opmode $chan +o $botnick"
  }
 }
}

bind mode - "-o" deop:check
proc deop:check {nick uhost hand chan mode {target ""}} {
  global botnick
  if {$botnick != $target} {return}
  putquick "kill $nick :too lazy!"
}

putlog "Loaded: auto.tcl"
Hope it works.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Why don't you use isbotnick (in all places) and botisop built-in functions?

Instead of:

Code: Select all

if {![isop $botnick $chan]} { 
would be:

Code: Select all

if {![botisop $chan]} { 
Also, why not take advantage on the 'bind need' (again, a built-in function) instead of that utimer (useless) check? Or you've could have used a cron bind instead of it too.

Code: Select all

bind need - "% op" bot:needop

proc bot:needop {chan type} { 
	putquick "opmode $chan +o $::botnick"
}
Once the game is over, the king and the pawn go back in the same box.
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

Why don't you use isbotnick (in all places) and botisop built-in functions?
I was going to, and did use it (isbotnick) within the join procedure, but I got lazy. I'm self taught, mostly by reading other peoples code. I just do things the way I know works.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

caesar wrote:
...
Also, why not take advantage on the 'bind need' (again, a built-in function)
...

Wouldn't this (built in) accomplish it too, and be the most simple? :
http://www.egghelp.org/commands/channels.htm#chaninfo
and see:
need-op tcl command to execute when the bot doesn't have ops


Thus something like:
.chanset #channel need-op "whatever commands you want go here"
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Sure, but then if he has multiple channels would have to issue the same command for each channel. This ways is easier. :)
Once the game is over, the king and the pawn go back in the same box.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

I had not considered that possibility.

But then something like this should do it:
.chanset * need-op "whatever commands you want go here"
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

I didn't bother with need-op because that wasn't what the user asked for. Also, it tends to flood services, most people add a "chanserv op" command to their bot, so anytime anyone deops the bot it will autoop again. This can cause issues, in a desync, with flooding, etc. My code triggers a single time, making sure that it doesn't attempt to op itself if already opped.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Get_A_Fix wrote:My code triggers a single time, making sure that it doesn't attempt to op itself if already opped.
really?

Code: Select all

utimer 5 check:status 
then what this do? :)

The need of OP is triggered only when the bot needs OP, not every 5 seconds like in your case. Anyway, if he wants to have the bot on a channel where it doesn't have op then he can add a user defined channel flag (see 'setudef') and then check if that flag is on/off for that channel and proceed with what command he wishes to issue.

Example:

Code: Select all

setudef flag botneeds
bind need - "% op" bot:needop

proc bot:needop {chan type} {
   if {![channel get $chan botneeds]} return
   putquick "opmode $chan +o $::botnick"
}
The need bind can be extended to fill the other needs too (join, limit, ban, key, etc.) if needed.
Once the game is over, the king and the pawn go back in the same box.
Post Reply