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 

Requesting 2 Scripts !admins and !rules

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


Joined: 19 May 2008
Posts: 101

PostPosted: Sat Aug 23, 2008 7:27 am    Post subject: Requesting 2 Scripts !admins and !rules Reply with quote

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 Very Happy
Have a nice Day.
Back to top
View user's profile Send private message
eXtremer
Op


Joined: 07 May 2008
Posts: 138

PostPosted: Sat Aug 23, 2008 10:48 am    Post subject: Re: Requesting 2 Scripts !admins and !rules Reply with quote

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 Very Happy
Have a nice Day.


1. !advert => http://www.egghelp.org/cgi-bin/tcl_archive.tcl?mode=download&id=1308

2. !userlist => http://www.egghelp.org/cgi-bin/tcl_archive.tcl?mode=download&id=1160
Back to top
View user's profile Send private message
Fraud
Op


Joined: 19 May 2008
Posts: 101

PostPosted: Sat Aug 23, 2008 11:57 am    Post subject: Reply with quote

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:
# 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
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Sat Aug 23, 2008 1:33 pm    Post subject: Reply with quote

First code.

Code:
# 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:
###

# 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)."
  }
}
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Fraud
Op


Joined: 19 May 2008
Posts: 101

PostPosted: Sun Aug 24, 2008 8:15 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
eXtremer
Op


Joined: 07 May 2008
Posts: 138

PostPosted: Sun Aug 24, 2008 12:14 pm    Post subject: Reply with quote

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


Joined: 19 May 2008
Posts: 101

PostPosted: Sun Aug 24, 2008 7:52 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Sun Aug 24, 2008 9:03 pm    Post subject: Reply with quote

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:

####################################################################################
##
##  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
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Fraud
Op


Joined: 19 May 2008
Posts: 101

PostPosted: Mon Aug 25, 2008 1:19 am    Post subject: Reply with quote

Nice Work. Thanks but the !addadmin <nick> is not working
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Mon Aug 25, 2008 1:36 am    Post subject: Reply with quote

code edited.

tested code and it work now.

Wink
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Fraud
Op


Joined: 19 May 2008
Posts: 101

PostPosted: Mon Aug 25, 2008 7:51 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Mon Aug 25, 2008 4:09 pm    Post subject: Reply with quote

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:
####################################################################################
##
##  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.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
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