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 

Radio script help

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


Joined: 17 May 2007
Posts: 2

PostPosted: Thu May 17, 2007 9:49 am    Post subject: Radio script help Reply with quote

Hello.
I found a script, who write in chanel the audition from our Internet Radio. I add all auditions with prv command to bot
Code:

+dodaj HH:MM Text

eg : +dodaj 21:00 Music
But all have an acces to this command. I want to change the script that, only some persons have acces to +dodaj command. The best veryficantion will be by the hostnames.
Code:

# Author: Tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.4
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# manual
# /msg <nazwa_bota> +dodaj 21:30 cos tam - dodaje ramowke, czas musi byc w formacie HH:MM,
# /msg <nazwa_bota> +czysc - pokaze liste z ramowkami i ich numerami
# /msg <nazwa_bota> +czysc <numer> - usunie ramowke o podanym numerze
# /msg <nazwa_bota> +czysc all - usunie wszystkie
# /msg <nazwa_bota> +czas - pokaze aktualny interwal (domyslnie co 15 minut)
# /msg <nazwa_bota> +czas <interwal> - zmieni obecny interwal na podany (minuty)

# kanal badz kanaly
set rm_channels {#kanal1 #kanal2}

#########################################
bind msgm - "*" privates_fct
bind time - "00 00 * * *" reset_ramowki

set ramowki_dir "ramowki"
set ramowki_db "$ramowki_dir/ramowki.db"
set ramowki_time "$ramowki_dir/time.db"

if {![file exists $ramowki_dir]} {
   file mkdir $ramowki_dir
}

if {![file exists $ramowki_time]} {
        set touch_time [open $ramowki_time w]
   puts $touch_time 15
   close $touch_time
}

if {![file exists $ramowki_db]} {
        set touch_db [open $ramowki_db w]
        close $touch_db
}
     
proc grab_time {} {
   global ramowki_time
   set tfs_open [open $ramowki_time r]
   gets $tfs_open time_out
   close $tfs_open
   return $time_out
}

proc set_rtime { rntime } {
   global ramowki_time
   set tfs_write [open $ramowki_time w]
   puts $tfs_write $rntime
   close $tfs_write
}

proc odliczadlo { } {
   show_ramowki
   if {[string match *odliczadlo* [timers]] != 1} {
      timer [grab_time] odliczadlo
   }
}

proc reset_db { } {
   global ramowki_db

   set clear_db [open $ramowki_db w]
   close $clear_db
}

proc get_db_data { } {
   global ramowki_db

   set open_db [open $ramowki_db]
        set all_db_data [read $open_db]
        close $open_db

   set all_db_lines [split $all_db_data "\n"]

   return $all_db_lines
}

proc add_ramowke { body } {
   global ramowki_db

   set file_hndl [open $ramowki_db a]
   puts $file_hndl "$body"
   close $file_hndl
}

proc del_ramowke { nrr } {
   global ramowki_db
   
   set uchwyt [open $ramowki_db]
        set all_ramowki [read $uchwyt]
        close $uchwyt

        set all_ramowki_lines [split $all_ramowki "\n"]
        set counter [llength $all_ramowki_lines]

   set handler [open $ramowki_db w]
        for {set i 0} {$i < $counter} {incr i 1} {
      if {$i == $nrr} {
         continue
      } {
         set each_ramowka_line [lindex $all_ramowki_lines $i]
         if {$each_ramowka_line != ""} {
            puts $handler $each_ramowka_line
         }
      }
   }
   close $handler
}

proc list_ramowki { niick } {
   set x 0
   foreach ramowka [get_db_data] {
      if {$ramowka != "" } {
         putquick "PRIVMSG $niick :$x\) $ramowka"
         incr x 1
      }
   }
}

proc privates_fct { nick uhost hand arg } {
   set all_args [split $arg]
   set first_arg [lindex $all_args 0]
   set second_arg [lindex $all_args 1]
   set other_arg [lrange $all_args 2 end]

   if {$first_arg == "+dodaj"} {
      if {$other_arg != "" } {
         add_ramowke "$second_arg $other_arg"
         putquick "PRIVMSG $nick :dodano"
      }
   }

   if {$first_arg == "+czysc"} {
      if {$second_arg == ""} {
         list_ramowki $nick
      } elseif {[regexp {^([0-9]+)$} $second_arg]} {
         del_ramowke $second_arg
         putquick "PRIVMSG $nick :usunieto"
      } elseif {$second_arg == "all"} {
         reset_db
         putquick "PRIVMSG $nick :usunieto wszystkie ramowki"
      }
   }

   if {$first_arg == "+czas"} {
      if {$second_arg == ""} {
         putquick "PRIVMSG $nick :aktualny interwal to [grab_time] minut|a|y"
      } elseif {[regexp {^([0-9]+)$} $second_arg]} {
         set_rtime $second_arg
         putquick "PRIVMSG $nick :zmieniono"
      }
   }
}

proc show_ramowki { } {
   global rm_channels
   
   foreach db_line [lsort [get_db_data]] {
      if {$db_line != ""} {
         set splited [split $db_line]
         set first_sp [lindex $splited 0]
         set other_sp [lrange $splited 1 end]

         foreach rchan $rm_channels {
            if {$rchan != ""} {
               if {[botonchan $rchan] == 1} {
                  putquick "PRIVMSG $rchan :\002$first_sp\002 $other_sp"
               }
            }
         }
      }
   }
}

proc reset_ramowki { min hour day month year } {
   reset_db
}

if {[string match *odliczadlo* [timers]] != 1} {
   timer [grab_time] odliczadlo
}

putlog "ramowki.tcl ver 0.4 by Tomekk loaded"
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri May 18, 2007 9:55 pm    Post subject: Reply with quote

Code:

# Author: Tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.4
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# manual
# /msg <nazwa_bota> +dodaj 21:30 cos tam - dodaje ramowke, czas musi byc w formacie HH:MM,
# /msg <nazwa_bota> +czysc - pokaze liste z ramowkami i ich numerami
# /msg <nazwa_bota> +czysc <numer> - usunie ramowke o podanym numerze
# /msg <nazwa_bota> +czysc all - usunie wszystkie
# /msg <nazwa_bota> +czas - pokaze aktualny interwal (domyslnie co 15 minut)
# /msg <nazwa_bota> +czas <interwal> - zmieni obecny interwal na podany (minuty)

# kanal badz kanaly
set rm_channels {#kanal1 #kanal2}

set allowuser {
"*!*@I.love.eggdrop,.org"
"*!*@127.0.0.*"
}
#########################################
bind msgm - "*" privates_fct
bind time - "00 00 * * *" reset_ramowki

set ramowki_dir "ramowki"
set ramowki_db "$ramowki_dir/ramowki.db"
set ramowki_time "$ramowki_dir/time.db"

if {![file exists $ramowki_dir]} {
   file mkdir $ramowki_dir
}

if {![file exists $ramowki_time]} {
        set touch_time [open $ramowki_time w]
   puts $touch_time 15
   close $touch_time
}

if {![file exists $ramowki_db]} {
        set touch_db [open $ramowki_db w]
        close $touch_db
}
     
proc grab_time {} {
   global ramowki_time
   set tfs_open [open $ramowki_time r]
   gets $tfs_open time_out
   close $tfs_open
   return $time_out
}

proc set_rtime { rntime } {
   global ramowki_time
   set tfs_write [open $ramowki_time w]
   puts $tfs_write $rntime
   close $tfs_write
}

proc odliczadlo { } {
   show_ramowki
   if {[string match *odliczadlo* [timers]] != 1} {
      timer [grab_time] odliczadlo
   }
}

proc reset_db { } {
   global ramowki_db

   set clear_db [open $ramowki_db w]
   close $clear_db
}

proc get_db_data { } {
   global ramowki_db

   set open_db [open $ramowki_db]
        set all_db_data [read $open_db]
        close $open_db

   set all_db_lines [split $all_db_data "\n"]

   return $all_db_lines
}

proc add_ramowke { body } {
   global ramowki_db

   set file_hndl [open $ramowki_db a]
   puts $file_hndl "$body"
   close $file_hndl
}

proc del_ramowke { nrr } {
   global ramowki_db
   
   set uchwyt [open $ramowki_db]
        set all_ramowki [read $uchwyt]
        close $uchwyt

        set all_ramowki_lines [split $all_ramowki "\n"]
        set counter [llength $all_ramowki_lines]

   set handler [open $ramowki_db w]
        for {set i 0} {$i < $counter} {incr i 1} {
      if {$i == $nrr} {
         continue
      } {
         set each_ramowka_line [lindex $all_ramowki_lines $i]
         if {$each_ramowka_line != ""} {
            puts $handler $each_ramowka_line
         }
      }
   }
   close $handler
}

proc list_ramowki { niick } {
   set x 0
   foreach ramowka [get_db_data] {
      if {$ramowka != "" } {
         putquick "PRIVMSG $niick :$x\) $ramowka"
         incr x 1
      }
   }
}

proc privates_fct { nick uhost hand arg } {
   global allowuser
   set all_args [split $arg]
   set first_arg [lindex $all_args 0]
   set second_arg [lindex $all_args 1]
   set other_arg [lrange $all_args 2 end]

   if {$first_arg == "+dodaj"} {
      if {$other_arg != "" } {
    foreach allowuser [string tolower $allowuser] {
    if {[string match *$allowuser* [string tolower $uhost]]} {
         add_ramowke "$second_arg $other_arg"
         putquick "PRIVMSG $nick :dodano"
        }
     }
  }
}
   if {$first_arg == "+czysc"} {
      if {$second_arg == ""} {
         list_ramowki $nick
      } elseif {[regexp {^([0-9]+)$} $second_arg]} {
         del_ramowke $second_arg
         putquick "PRIVMSG $nick :usunieto"
      } elseif {$second_arg == "all"} {
         reset_db
         putquick "PRIVMSG $nick :usunieto wszystkie ramowki"
      }
   }

   if {$first_arg == "+czas"} {
      if {$second_arg == ""} {
         putquick "PRIVMSG $nick :aktualny interwal to [grab_time] minut|a|y"
      } elseif {[regexp {^([0-9]+)$} $second_arg]} {
         set_rtime $second_arg
         putquick "PRIVMSG $nick :zmieniono"
      }
   }
}

proc show_ramowki { } {
   global rm_channels
   
   foreach db_line [lsort [get_db_data]] {
      if {$db_line != ""} {
         set splited [split $db_line]
         set first_sp [lindex $splited 0]
         set other_sp [lrange $splited 1 end]

         foreach rchan $rm_channels {
            if {$rchan != ""} {
               if {[botonchan $rchan] == 1} {
                  putquick "PRIVMSG $rchan :\002$first_sp\002 $other_sp"
               }
            }
         }
      }
   }
}

proc reset_ramowki { min hour day month year } {
   reset_db
}

if {[string match *odliczadlo* [timers]] != 1} {
   timer [grab_time] odliczadlo
}

putlog "ramowki.tcl ver 0.4 by Tomekk loaded"


try this should work, have'nt tested though.
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
TheViP
Voice


Joined: 17 May 2007
Posts: 2

PostPosted: Sat May 19, 2007 8:26 pm    Post subject: Reply with quote

yes, thx worx propertly but can u do that too for commands : +czysc and +czas

Thanx
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Sun May 20, 2007 11:53 am    Post subject: Reply with quote

Code:

# Author: Tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.4
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# manual
# /msg <nazwa_bota> +dodaj 21:30 cos tam - dodaje ramowke, czas musi byc w formacie HH:MM,
# /msg <nazwa_bota> +czysc - pokaze liste z ramowkami i ich numerami
# /msg <nazwa_bota> +czysc <numer> - usunie ramowke o podanym numerze
# /msg <nazwa_bota> +czysc all - usunie wszystkie
# /msg <nazwa_bota> +czas - pokaze aktualny interwal (domyslnie co 15 minut)
# /msg <nazwa_bota> +czas <interwal> - zmieni obecny interwal na podany (minuty)

# kanal badz kanaly
set rm_channels {#kanal1 #kanal2}

set allowuser {
"*!*@I.love.eggdrop,.org"
"*!*@127.0.0.*"
}
#########################################
bind msgm - "*" privates_fct
bind time - "00 00 * * *" reset_ramowki

set ramowki_dir "ramowki"
set ramowki_db "$ramowki_dir/ramowki.db"
set ramowki_time "$ramowki_dir/time.db"

if {![file exists $ramowki_dir]} {
   file mkdir $ramowki_dir
}

if {![file exists $ramowki_time]} {
        set touch_time [open $ramowki_time w]
   puts $touch_time 15
   close $touch_time
}

if {![file exists $ramowki_db]} {
        set touch_db [open $ramowki_db w]
        close $touch_db
}
     
proc grab_time {} {
   global ramowki_time
   set tfs_open [open $ramowki_time r]
   gets $tfs_open time_out
   close $tfs_open
   return $time_out
}

proc set_rtime { rntime } {
   global ramowki_time
   set tfs_write [open $ramowki_time w]
   puts $tfs_write $rntime
   close $tfs_write
}

proc odliczadlo { } {
   show_ramowki
   if {[string match *odliczadlo* [timers]] != 1} {
      timer [grab_time] odliczadlo
   }
}

proc reset_db { } {
   global ramowki_db

   set clear_db [open $ramowki_db w]
   close $clear_db
}

proc get_db_data { } {
   global ramowki_db

   set open_db [open $ramowki_db]
        set all_db_data [read $open_db]
        close $open_db

   set all_db_lines [split $all_db_data "\n"]

   return $all_db_lines
}

proc add_ramowke { body } {
   global ramowki_db

   set file_hndl [open $ramowki_db a]
   puts $file_hndl "$body"
   close $file_hndl
}

proc del_ramowke { nrr } {
   global ramowki_db
   
   set uchwyt [open $ramowki_db]
        set all_ramowki [read $uchwyt]
        close $uchwyt

        set all_ramowki_lines [split $all_ramowki "\n"]
        set counter [llength $all_ramowki_lines]

   set handler [open $ramowki_db w]
        for {set i 0} {$i < $counter} {incr i 1} {
      if {$i == $nrr} {
         continue
      } {
         set each_ramowka_line [lindex $all_ramowki_lines $i]
         if {$each_ramowka_line != ""} {
            puts $handler $each_ramowka_line
         }
      }
   }
   close $handler
}

proc list_ramowki { niick } {
   set x 0
   foreach ramowka [get_db_data] {
      if {$ramowka != "" } {
         putquick "PRIVMSG $niick :$x\) $ramowka"
         incr x 1
      }
   }
}

proc privates_fct { nick uhost hand arg } {
   global allowuser
   set all_args [split $arg]
   set first_arg [lindex $all_args 0]
   set second_arg [lindex $all_args 1]
   set other_arg [lrange $all_args 2 end]

   if {$first_arg == "+dodaj"} {
      if {$other_arg != "" } {
    foreach allowuser [string tolower $allowuser] {
    if {[string match *$allowuser* [string tolower $uhost]]} {
         add_ramowke "$second_arg $other_arg"
         putquick "PRIVMSG $nick :dodano"
        }
     }
  }
}
   if {$first_arg == "+czysc"} {
      if {$second_arg == ""} {
      foreach allowuser [string tolower $allowuser] {
      if {[string match *$allowuser* [string tolower $uhost]]} {
         list_ramowki $nick
      } elseif {[regexp {^([0-9]+)$} $second_arg]} {
         del_ramowke $second_arg
         putquick "PRIVMSG $nick :usunieto"
      } elseif {$second_arg == "all"} {
         reset_db
         putquick "PRIVMSG $nick :usunieto wszystkie ramowki"
        }
     }
  }

   if {$first_arg == "+czas"} {
      if {$second_arg == ""} {
    foreach allowuser [string tolower $allowuser] {
    if {[string match *$allowuser* [string tolower $uhost]]} {
       putquick "PRIVMSG $nick :aktualny interwal to [grab_time] minut|a|y"
      } elseif {[regexp {^([0-9]+)$} $second_arg]} {
         set_rtime $second_arg
         putquick "PRIVMSG $nick :zmieniono"
        }
      }
    }
  }
}
proc show_ramowki { } {
   global rm_channels
   
   foreach db_line [lsort [get_db_data]] {
      if {$db_line != ""} {
         set splited [split $db_line]
         set first_sp [lindex $splited 0]
         set other_sp [lrange $splited 1 end]

         foreach rchan $rm_channels {
            if {$rchan != ""} {
               if {[botonchan $rchan] == 1} {
                  putquick "PRIVMSG $rchan :\002$first_sp\002 $other_sp"
               }
            }
         }
      }
   }
}

proc reset_ramowki { min hour day month year } {
   reset_db
}

if {[string match *odliczadlo* [timers]] != 1} {
   timer [grab_time] odliczadlo
}

putlog "ramowki.tcl ver 0.4 by Tomekk loaded"


Try this and tell me if there is any problem.
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
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