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 

When eggdrop has no op on channel

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


Joined: 10 Jan 2012
Posts: 1

PostPosted: Tue Jan 10, 2012 12:38 am    Post subject: When eggdrop has no op on channel Reply with quote

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 Cool Cool Cool Smile
Back to top
View user's profile Send private message
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Thu Jan 19, 2012 11:54 am    Post subject: Reply with quote

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

Code:

# 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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri Jan 20, 2012 2:24 am    Post subject: Reply with quote

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

Instead of:
Code:

if {![isop $botnick $chan]} {

would be:
Code:

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:

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.
Back to top
View user's profile Send private message
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Fri Jan 20, 2012 6:25 am    Post subject: Reply with quote

Quote:
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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Fri Jan 20, 2012 9:55 am    Post subject: Reply with quote

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"
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sat Jan 21, 2012 4:26 am    Post subject: Reply with quote

Sure, but then if he has multiple channels would have to issue the same command for each channel. This ways is easier. Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sat Jan 21, 2012 10:58 am    Post subject: Reply with quote

I had not considered that possibility.

But then something like this should do it:
.chanset * need-op "whatever commands you want go here"
Back to top
View user's profile Send private message
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Tue Jan 24, 2012 12:24 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Jan 25, 2012 12:09 pm    Post subject: Reply with quote

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:

utimer 5 check:status

then what this do? Smile

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:

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.
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