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.

Requesting 2 Scripts !admins and !rules

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Requesting 2 Scripts !admins and !rules

Post by Fraud »

Hello to the Board.

i ask everybody to help me. My Channel is looking for 2 Scripts.
1. is a rules script where we can add some Text in a text File that will be posted by writing something like ?rules (maybe some spamcheck and the text as notice or Private)

2. is a, hmmm how to explain it, a script where we can add users and this will be printed in the chan as Helper or admins.
so what i mean is, somebody types !admins and he get a list of People (s)he can contact. maybe its possible to use a trigger system to add Admins, Helpers and so on.

Thanks to all of you for the view and maybe Help :D
Have a nice Day.
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

Re: Requesting 2 Scripts !admins and !rules

Post by eXtremer »

jonlar wrote:Hello to the Board.

i ask everybody to help me. My Channel is looking for 2 Scripts.
1. is a rules script where we can add some Text in a text File that will be posted by writing something like ?rules (maybe some spamcheck and the text as notice or Private)

2. is a, hmmm how to explain it, a script where we can add users and this will be printed in the chan as Helper or admins.
so what i mean is, somebody types !admins and he get a list of People (s)he can contact. maybe its possible to use a trigger system to add Admins, Helpers and so on.

Thanks to all of you for the view and maybe Help :D
Have a nice Day.
1. !advert => http://www.egghelp.org/cgi-bin/tcl_arch ... ad&id=1308

2. !userlist => http://www.egghelp.org/cgi-bin/tcl_arch ... ad&id=1160
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Post by Fraud »

Is it possible to extend this script with a spamprotect and -check?

If somebody uses !rules and somebody different want to use the trigger too, he gets a notice with:" Please wait. Next !rules Request possible in X seconds"?

Code: Select all

# rules1.0.tcl inspired by `Dracu|a`
# rewritten from tell1.1.tcl (Lassi Lahtinen lahtinen.lassi@nic.fi) by Wanderer|
# final debug by ShadowLord 
# email me @: jjmacgregor@kscable.com
# version 1.0 a simple and to the point TCL :)

# You can ask help: 
# 1. by emailing me
# 2. I'm on Dalnet in #VladTepes
# 3. Wanderer| is on UnderNET in #TCL
# thanks a lot to Wanderer| and ShadowLord!

# you can start to use rules1.0.tcl after you change "line1" and "line2" (btw 
# you can add lines "line 3" "line 4" etc it's not restricted) to your 
# channel's rules and write public command !rules or !rules <nick> on your chan!

# commands: !rules pastes the rules on open channel !rules <nick> will /notice a 
# individual person the channel rules.

set chanrules {
"line 1"
"line 2"
}
bind pub o !rules pub:t
proc pub:t {nick uhost hand chan text} {
global chanrules
set rulenick [lindex [split $text " "] 0]
if {$text != "" && [onchan $rulenick $chan]} {
puthelp "NOTICE $rulenick :these are the rules of our channel. Pay attention!"
foreach line $chanrules { puthelp "NOTICE $rulenick :$line" }
return 0
}
foreach line $chanrules {puthelp "PRIVMSG $chan :$line" }
}

The second is just using the bots Userlist. i would like to add the user to a list of Supporters
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

First code.

Code: Select all

# You can ask help: 
# 1. by emailing me 
# 2. I'm on Dalnet in #VladTepes 
# 3. Wanderer| is on UnderNET in #TCL 
# thanks a lot to Wanderer| and ShadowLord!
Second.

Code: Select all

###

# trigger
set waffles(cmd) "!admin"

# Admins list
set waffles(list) "nick1 nick2 nick3 ... nick8"

###

bind pub - $waffles(cmd) pub:needadmin

proc pub:needadmin { nick host hand chan arg } {
  global waffles
  set counter 0
  foreach ad [split $waffles(list)] {
     if {[onchan $ad $chan]} {
         putquick "PRIVMSG $ad :\037$nick\017 need help of an admin."
         incr counter
     }
  }

  if {$counter == 0} {
     putquick "PRIVMSG $chan :sorry $nick, No such Admin Online."
  } else {
     putquick "PRIVMSG $chan :$nick, your resquest has been send to admins. (admins: $waffles(list)."
  }
}
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Post by Fraud »

First of all, thank u for this. But is it possible to add a spamcheck and cant it be used it this way

!add admin <name>
!del admin <name>

thanks a lot
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

Post by eXtremer »

jonlar wrote:First of all, thank u for this. But is it possible to add a spamcheck and cant it be used it this way

!add admin <name>
!del admin <name>

thanks a lot
Use LoL Toolz, by leonini, search here: http://egghelp.org/tcl.htm

It has the !addmaster (+m) !addowner (+n) and other commands.
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Post by Fraud »

But this is a complete Script with Channel security and more.

Hmm does nobody understands me ?

I just need a script where i have triggers with !admin add/del and if somebody types !admins he gehts a notice with some names i was adding before. thats it.

the one of Nor7on is good but i am looking for a trigger system integratetd
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

try it, no tested.

!admins - displays admins on channel.
!deladmin - delete admins (u need have +m or +n)
!addadmin - add admins. (u need have +m or +n)

Code: Select all

#################################################################################### 
## 
##  CheckMasters 
##  Version 1.0 
##  by xiv 
## 
##  This script will display the handles of the bot owners & channel masters. 
##  It will also check who are on at the moment. 
## 
##  For security reasons, I added a flood protection 
## 

# do you want the bot to make a differance between owners & masters? 
set display_owners 0 

# set here the trigger for flood 
set masters_flood 1:20 

bind pub - !admins pub_masters 
bind pub m|m !deladmin proc_deluser 
bind pub m|m !addadmin proc_adduser 

# -- don't edit below unless you know what you are doing -- 

proc pub_masters {nick uhost hand channel args} { 

   # detect flood 
   if {[masters_detectflood]} { 
      putcmdlog "<$nick@$channel> !$hand! masters (flood... not answering!)" 
      putserv "NOTICE $nick :don't flood the bots" 
      return 0 
   } 

   # Initializing variables 
   global botnick display_owners 
   set count_owners 0 
   set count_owners_on 0 
   set count_masters 0 
   set count_masters_on 0 
   set owners "" 
   set owners_on "" 
   set masters "" 
   set masters_on "" 

   # finding all owners in userlist if 'display_owners' setting is set to 1 
   if { $display_owners } { 
      foreach user [userlist] { 
         if [matchattr $user n $channel] { 
            set owners [string trim "$owners, $user" ", "] 
            incr count_owners 1 
         } 
      } 
      if {[string length $owners] > 0} { 
         putchan $channel "$count_owners owner(s) of the bots: $owners." 
      } 
   } 

   # finding all masters in userlist 
   foreach user [userlist] { 
      if [matchattr $user |R $channel] { 
         if { (![matchattr $user n]) || ($display_owners == 0) } { 
            set masters [string trim "$masters, $user" ", "] 
            incr count_masters 1 
         } 
      } 
   } 
   if {[string length $masters] > 0} { 
      putchan $channel "$count_masters Admin(s) defined for $channel: $masters." 
   } else { 
      putchan $channel "There are currently no Admin's defined for $channel." 
   } 

   # displaying owners that are on if 'display_owners' setting is set to 1 
   if { $display_owners } { 
      foreach owner_on [chanlist $channel n] { 
         set owners_on [string trim "$owners_on, $owner_on" ", "] 
         incr count_owners_on 1 
      } 
      if {[string length $owners_on] > 0} { 
         putchan $channel "Wohoo, $count_owners_on owner(s) of the bots currently on: $owners_on." 
      } 
   } 

   # displaying masters that are on 
   foreach master_on [chanlist $channel |R] { 
      if { (![matchattr $master_on n]) || ($display_owners == 0) } { 
         set masters_on [string trim "$masters_on, $master_on" ", "] 
         incr count_masters_on 1 
      } 
   } 
   if {[string length $masters_on] > 0} { 
      putchan $channel "$count_masters_on Admin(s) currently on: $masters_on." 
   } else { 
      putchan $channel "There are currently no Admin on $channel." 
   } 
} 

# Avoids flooding 
proc masters_detectflood { } { 
        global masters_flood 
        global masters_floodtrigger 
        set thr [lindex [split $masters_flood ":"] 0] 
        set lapse [lindex [split $masters_flood ":"] 1] 
        if {$thr == "" || $thr == 0} { return 0 } 
        if {![info exist masters_floodtrigger]} { 
                # First time called 
                set masters_floodtrigger [list [unixtime] 1] 
                return 0 
        } 
        if {[expr [lindex $masters_floodtrigger 0] + $lapse] <= [unixtime]} { 
                # Trigger time has passed, reset counter 
                set masters_floodtrigger [list [unixtime] 1] 
                return 0 
        } 
        set lasttime [lindex $masters_floodtrigger 0] 
        set times [lindex $masters_floodtrigger 1] 
        if {$times >= $thr} { 
                # Flood! 
                return 1 
        } 
        set masters_floodtrigger [list $lasttime [expr $times + 1]] 
        return 0 
} 

proc proc_adduser { nick uhost hand chan text } { 
	set newnick [lindex $text 0]
  set addusernick [nick2hand $newnick] 
  if {[validuser $addusernick]} { 
   putserv "PRIVMSG $chan :\002$newnick\002 Is Already an ADMIN Database As \002$addusernick\002" 
  } else  { 
   unset addusernick 
   set addusermask [maskhost $newnick![getchanhost $newnick $chan]] 
   adduser $newnick $addusermask 
   set addusernick [nick2hand $newnick]
   chattr $addusernick |+R $chan 
   putlog "\002$nick\002 Added \002$addusernick\($newnick - $addusernick\)\002 To ADMIN Database" 
   putserv "PRIVMSG $chan :\002$text\002 Added To ADMIN Database As \002$addusernick\002" 
   unset addusermask 
   unset newnick
   unset addusernick 
  } 
} 

proc proc_deluser { nick uhost hand chan text } { 
  set delusernick [lindex $text 0]
  if {[validuser $delusernick]} { 
    deluser $delusernick 
    putserv "PRIVMSG $chan :\002$text \($delusernick\)\002 Has Been Removed From ADMIN Database" 
    putlog "$nick Removed $delusernick From user Database" 
  } else { putserv "PRIVMSG $chan :\002$text\002 Not Found In ADMIN Database, Use !whois <nickname>" } 
} 


putlog "--- CheckMasters 1.0 by xiv loaded ---"
Last edited by Nor7on on Mon Aug 25, 2008 1:42 am, edited 2 times in total.
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Post by Fraud »

Nice Work. Thanks but the !addadmin <nick> is not working
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

code edited.

tested code and it work now.

:wink:
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Post by Fraud »

Well seems it works now. but i still have errors.

- When i add somebody that is not listed in the chan the script adds at all.
- i cannot add myself.
- maybe u can rewrite it this way that it can be activated for specific chans?
Like <!admin #channel on> and then the rest of the Triggersystem.

I know lots i want but maybe it is possible that barcelona helps mallorca.

Venga. Muchas Gracias por tu ayuda.
Saludos jonlar

edit: i use i t on quakenet and i tried the trigger again but the added fictiv user is not added too. Its just written in the Partyline but not added
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

When u add an admin. the new admin it must put: /msg botnick pass <password>

!admins | show admins
!deladmin | del admins
!addadmin | add admin
!admin <channel> <on/off> | switch on/off admins help.

tested and work.

Code: Select all

#################################################################################### 
## 
##  CheckMasters 
##  Version 1.0 
##  by xiv 
## 
##  This script will display the handles of the bot owners & channel masters. 
##  It will also check who are on at the moment. 
## 
##  For security reasons, I added a flood protection 
## 

# do you want the bot to make a differance between owners & masters? 
set display_owners 0 

# set here the trigger for flood 
set masters_flood 1:20 

bind pub - !admins pub_masters 
bind pub m|m !deladmin proc_deluser 
bind pub m|m !addadmin proc_adduser 
bind pub m|m !admin admin:switch

setudef flag helpadmin

# -- don't edit below unless you know what you are doing -- 

proc pub_masters {nick uhost hand channel args} { 
	global helpadmin
   	if {![channel get $channel helpadmin]} { 
	return 
	} 
   if {[masters_detectflood]} { 
      putcmdlog "<$nick@$channel> !$hand! masters (flood... not answering!)" 
      putserv "NOTICE $nick :don't flood the bots" 
      return 0 
   } 

   # Initializing variables 
   global botnick display_owners 
   set count_owners 0 
   set count_owners_on 0 
   set count_masters 0 
   set count_masters_on 0 
   set owners "" 
   set owners_on "" 
   set masters "" 
   set masters_on "" 

   # finding all owners in userlist if 'display_owners' setting is set to 1 
   if { $display_owners } { 
      foreach user [userlist] { 
         if [matchattr $user n $channel] { 
            set owners [string trim "$owners, $user" ", "] 
            incr count_owners 1 
         } 
      } 
      if {[string length $owners] > 0} { 
         putchan $channel "$count_owners owner(s) of the bots: $owners." 
      } 
   } 

   # finding all masters in userlist 
   foreach user [userlist] { 
      if [matchattr $user |T $channel] { 
         if { (![matchattr $user n]) || ($display_owners == 0) } { 
            set masters [string trim "$masters, $user" ", "] 
            incr count_masters 1 
         } 
      } 
   } 
   if {[string length $masters] > 0} { 
      putchan $channel "$count_masters admins  on $channel: $masters." 
   } else { 
      putchan $channel "In this moment don't have admins on $channel." 
   } 

   # displaying owners that are on if 'display_owners' setting is set to 1 
   if { $display_owners } { 
      foreach owner_on [chanlist $channel n] { 
         set owners_on [string trim "$owners_on, $owner_on" ", "] 
         incr count_owners_on 1 
      } 
      if {[string length $owners_on] > 0} { 
         putchan $channel "Wohoo, $count_owners_on owner(s) of the bots currently on: $owners_on." 
      } 
   } 

   # displaying masters that are on 
   foreach master_on [chanlist $channel |T] { 
      if { (![matchattr $master_on n]) || ($display_owners == 0) } { 
         set masters_on [string trim "$masters_on, $master_on" ", "] 
         incr count_masters_on 1 
      } 
   } 
   if {[string length $masters_on] > 0} { 
      putchan $channel "$count_masters_on Admins currently ON: $masters_on." 
   } else { 
      putchan $channel "don't have admins online now." 
   } 
} 

# Avoids flooding 
proc masters_detectflood { } { 
        global masters_flood 
        global masters_floodtrigger 
        set thr [lindex [split $masters_flood ":"] 0] 
        set lapse [lindex [split $masters_flood ":"] 1] 
        if {$thr == "" || $thr == 0} { return 0 } 
        if {![info exist masters_floodtrigger]} { 
                # First time called 
                set masters_floodtrigger [list [unixtime] 1] 
                return 0 
        } 
        if {[expr [lindex $masters_floodtrigger 0] + $lapse] <= [unixtime]} { 
                # Trigger time has passed, reset counter 
                set masters_floodtrigger [list [unixtime] 1] 
                return 0 
        } 
        set lasttime [lindex $masters_floodtrigger 0] 
        set times [lindex $masters_floodtrigger 1] 
        if {$times >= $thr} { 
                # Flood! 
                return 1 
        } 
        set masters_floodtrigger [list $lasttime [expr $times + 1]] 
        return 0 
} 

proc proc_adduser { nick uhost hand chan text } { 
	global helpadmin
   	if {![channel get $chan helpadmin]} { return } 
	set newnick [lindex $text 0]
  set addusernick [nick2hand $newnick] 
  if {[validuser $addusernick]} { 
   putserv "PRIVMSG $chan :\002$newnick\002 Is Already an ADMIN Database As \002$addusernick\002" 
  } else  { 
   unset addusernick 
   set addusermask [maskhost $newnick![getchanhost $newnick $chan]] 
   adduser $newnick $addusermask 
   set addusernick [nick2hand $newnick]
   chattr $addusernick |+T $chan 
   putlog "\002$nick\002 Added \002$addusernick\($newnick - $addusernick\)\002 To ADMIN Database" 
   putserv "PRIVMSG $chan :\002$text\002 Added To ADMIN Database As \002$addusernick\002" 
   unset addusermask 
   unset newnick
   unset addusernick 
  } 
} 

proc proc_deluser { nick uhost hand chan text } { 
	global helpadmin
   	if {![channel get $chan helpadmin]} { return } 
  set delusernick [lindex $text 0]
  if {[validuser $delusernick]} { 
    deluser $delusernick 
    putserv "PRIVMSG $chan :\002$text \($delusernick\)\002 Has Been Removed From ADMIN Database" 
    putlog "$nick Removed $delusernick From user Database" 
  } else { putserv "PRIVMSG $chan :\002$text\002 Not Found In ADMIN Database, Use !whois <nickname>" } 
} 

proc admin:switch {nickname hostname channel handle text} { 
set cmd [lindex [split $text] 1]
set adminchan [lindex [split $text] 0]
switch -exact $cmd {
 "on" {
	channel set $adminchan +helpadmin
	puthelp "NOTICE $nickname :Admins Channel is now ON in $adminchan"
	}
 "off" {
	channel set $adminchan -helpadmin
	puthelp "NOTICE $nickname :Admins Channel is now OFF in $adminchan"
		}
	}
}


putlog "--- CheckMasters 1.0 by xiv loaded ---"
Cya.
Post Reply