Code: Select all
# Location of the file to store data in.
set released(datafile) "/dat/released.dat"
#set released(datafile) "/home/eggdrop/released.dat"
#Elviraa
#set released(datafile) "~/released.dat"
# Change this if you have bots linked in that you don't want to reload
# the released datafile when another bot is updated.
# (This is great if you're like me and clone your bots for channel linking
# and have them sharing a single data file)
set released(netcode) 927
# Set this to the name of the group/individual releasing the files
set released(group_name) ""
# Set this to the channels you want new releases announced in.
# Use * for all channels the bot is currentlly on.
set released(announce_channels) ""
# This is the format of the 'new release' announcment.
# Variables to use are:
# %release% - Program name/version
# %group% - Text as defined by $released(group_name)
set released(announce_format) "%release% was just released by %group%."
# [0/1] Set this to 1 if you want a new release notification sent threw
# the botnet to be announced on channels connected bots are on.
set released(announce_botnet) 0
# Set this to how many records you want it to keep track of.
set released(max) 10
# Access flag needed to add an entry
set released(entryaccess) "m"
# Access flag needed to remove and entry
set released(killaccess) "m"
set released(noentries) {-=: \002There have been no releases recorded\002 :=-}
set released(header) {
{The following are the latest releases, brought to you by DrN!
}
}
set released(footer) {
{Note - .}
}
set released(ver) "v1.02.02"
#set cmdchar_ "*"
#proc cmdchar { } {
#global cmdchar_
#return $cmdchar_
#}
for {set rloop 1} {$rloop < [expr $released(max) + 1]} {incr rloop} {set released($rloop) ""}
bind pub - newmovies pub_released
proc pub_released {nick uhost hand channel rest} {
global released
set rnum 0
foreach oline $released(header) {putserv "NOTICE $nick :[set_control $nick $channel $oline]"}
for {set rloop 1} {$rloop < [expr $released(max) + 1]} {incr rloop} {
if {$released($rloop) != ""} {set r_time [ctime [lindex $released($rloop) 0]]
set r_desc [lrange $released($rloop) 1 end]
putserv "NOTICE $nick : [format "%2s" $rloop]: $r_time - $r_desc"
incr rnum
}
}
if {$rnum == 0} {putserv "NOTICE $nick :[set_control $nick $channel $released(noentries)]"}
foreach oline $released(footer) {putserv "NOTICE $nick :[set_control $nick $channel $oline]"}
}
bind pub $released(killaccess) killrelease pub_killrelease
proc pub_killrelease {nick uhost hand channel rest} {
global released network
if {($rest < 0) || ($rest > $released(max))} {putserv "NOTICE $nick :$rest is an invalid entry. Must be between 1 and $released(max)"
return 0}
if {$released(1) == ""} {putserv "NOTICE $nick :There are no release notes in the database."
return 0}
for {set rloop $rest} {$rloop < $released(max)} {incr rloop} {
set rloop1 [expr $rloop + 1]
set released($rloop) $released($rloop1)
}
set released($released(max)) ""
putserv "NOTICE $nick :#$rest has been deleted."
save_released
putallbots "reloadreleased $released(netcode) $network"
}
bind pub $released(entryaccess) newrelease pub_newrelease
proc pub_newrelease {nick uhost hand chan rest} {
global released network
if {$rest == ""} {putserv "NOTICE $nick :Calling Syntax: newrelease Some text string"
return 0}
for {set rloop $released(max)} {$rloop > 1} {incr rloop -1} {
set rloop1 [expr $rloop - 1]
set released($rloop) $released($rloop1)
}
set released(1) "[unixtime] $rest"
putserv "NOTICE $nick :Added entry for [ctime [unixtime]] as $rest"
announce_release "$rest"
save_released
putallbots "reloadreleased $released(netcode) $network"
if {$released(announce_botnet) == 1} {putallbots "announcereleased $released(netcode) $network $rest"}
}
proc announce_release {txt} {
global released
set chans $released(announce_channels)
if {$chans == "*"} {set chans [channels]}
set atext $released(announce_format)
regsub -all {%release%} $atext $txt atext
regsub -all {%group%} $atext $released(group_name) atext
foreach chan $chans {puthelp "PRIVMSG $chan :$atext"}
}
proc save_released {} {
global released
putlog "Saving Released $released(ver) Data"
set out [open $released(datafile) w]
for {set rloop 1} {$rloop < [expr $released(max) + 1]} {incr rloop} {puts $out $released($rloop)}
close $out
}
proc load_released {} {
global released
if {[file exists $released(datafile)]} {
putlog "Loading Released data from $released(datafile)"
set in [open $released(datafile) r]
for {set rloop 1} {$rloop < [expr $released(max) + 1]} {incr rloop} {set released($rloop) [gets $in]}
close $in
}
}
load_released
# putallbots "reloadreleased $released(netcode) $network"
bind bot - reloadreleased reloadreleased_in
proc reloadreleased_in {bot cmd arg} {
global released
set c [lindex $arg 0]
set n [lindex $arg 1]
if {$c == $released(netcode)} {
putlog "RELEASED: Reload Request from $n -$c-"
load_released
} else {putlog "RELEASED: Ignored Reload Request from $n -$c-"}
}
# putallbots "announcereleased $released(netcode) $network prgname"
bind bot - announcereleased announcereleased_in
proc announcereleased_in {bot cmd arg} {
global released
if {$released(announce_botnet) != 1} {return 0}
set c [lindex $arg 0]
set n [lindex $arg 1]
set t [lrange $arg 2 end]
if {$c == $released(netcode)} {
putlog "RELEASED: Announce Request from $n -$c- :$t"
announce_release "$t"
} else {putlog "RELEASED: Ignored Reload Request from $n -$c-"}
}
proc set_control {nick chan outmsg} {
regsub -all {\$nick} $outmsg $nick outmsg
regsub -all {\$chan} $outmsg $chan outmsg
regsub -all {\\001} $outmsg \001 outmsg
regsub -all {\\002} $outmsg \002 outmsg
regsub -all {\\026} $outmsg \026 outmsg
return "$outmsg"
}