Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;############################
- ;#
- ;# XDCC SearchBOT Script - Original downloaded from: http://www.hawkee.com/snippet/608/
- ;#
- ;############################
- ;# To Do:
- ;# Low Priority: Add A Pm trigger to change new release trigger/time, request enable disable
- ;# Medium Priority: Update the help, change the method it displays its help with
- ;#############################
- ; Startup/Shutdown Events
- ;#############################
- ;#
- ;# Loads Settings, Makes required Directories to prevent errors.
- ;#
- on *:start: { sb.startup }
- on *:unload: { sb.close }
- ;#
- ;# Saves Settings and indexes
- on *:exit: { sb.close }
- ;#
- ;# Makes the bot join its channels. Starts timers to save indexes and check for old releases.
- on *:connect: { if ($network == $hget(SearchBOT.settings,network)) && ($hget(SearchBOT.settings,enable) == 1) { join $hget(SearchBOT.settings,indexchan) | .timerSearchBOTsave 0 600 sb.saveindexes } }
- on me:*:JOiN:#: {
- if ($istok($hget(SearchBOT.settings,indexchan),$chan,44)) { $+(.,timer,check.releases.,$chan) 0 600 sb.checkreleasetimes $chan
- if ($hget(SearchBOT.settings,$+($chan,.adtime))) {
- if (!$hget(SearchBOT.settings,$+($chan,.advert))) && ($hget(SearchBOT.settings,default)) { $+(.,timer,$chan,.advert) 0 $hget(SearchBOT.settings,$+($chan,.adtime)) .msg $chan $hget(SearchBOT.settings,default) }
- elseif ($hget(SearchBOT.settings,$+($chan,.advert))) { $+(.,timer,$chan,.advert) 0 $hget(SearchBOT.settings,$+($chan,.adtime)) .msg $chan $hget(SearchBOT.settings,$+($chan,.advert)) }
- }
- }
- }
- ;#
- ;# Advertises version
- ;#
- ;ctcp *:VERSION:*:/ctcpreply $nick VERSION SearchBOT 2.8
- ;#
- ;# Enables you to turn the bot on.
- menu channel { $iif($hget(SearchBOT.settings,enable) == 1, Turn SearchBOT off, Turn SearchBOT on):$iif($hget(SearchBOT.settings,enable) == 1, hadd SearchBOT.settings enable 0, hadd -m SearchBOT.settings enable 1) }
- ;# Code to allow remote bot updates. Only allows SearchBOT.mrc , creates backups. Only Owners will have access to this.
- ;#
- on *:FileRCVD:*: {
- if (!$hget(SearchBOT.sessions,$nick)) { .remove $+(",$filename,") | .msg $nick You're send has been removed. }
- elseif ( $nopath($filename) == SearchBOT.mrc ) && ($hget(SearchBOT.sessions,$nick)) {
- .copy $+(",$scriptdir,SearchBOT.mrc,") $+(",$scriptdir,backup/,$asctime(mmm-dd-yyyy-HH-mm-ss),-SearchBOT.mrc,")
- .copy -o $+(",$filename,") $+(",$scriptdir,SearchBOT.mrc,")
- .remove $+(",$filename,")
- .timer 1 1 .msg $nick Script Successfully Backed Up and Reloaded.
- .close -g $nick
- .reload -rs $+(",$scriptdir,SearchBOT.mrc,")
- }
- }
- ;# Disables dcc ignore if an owner tries to send an update and itis ignored.
- on *:GetFAiL:*: { if ( $nopath($filename) == SearchBOT.mrc ) && ($hget(SearchBOT.sessions,$nick)) { .msg $nick Please resend the file. Ignore is now turned off. } }
- ;#####################
- ; SearchBOT Aliases
- ;#####################
- ;#
- ;# Startup/Shutdown Aliases
- ;# No Parameters are passed to any aliases in the Startup/Shutdown Aliases. Other Sections have examples with each alias.
- ;#
- ;# Startup events
- alias sb.startup {
- hfree -w SearchBOT.*
- hmake SearchBOT.settings
- if (!$isdir($+(",$scriptdirdata/,"))) mkdir $+(",$scriptdirdata/,")
- if ($readini($+(",$scriptdir,SearchBOT.ini,"),n,SearchBOT,enable) == $null) { hadd -m SearchBOT.settings enable 1 }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,enable) == 1) { hadd -m SearchBOT.settings enable 1
- server $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,server) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,requests.enable)) {
- hadd SearchBOT.settings requests.enable $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,requests.enable) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,network)) {
- hadd SearchBOT.settings network $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,network) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,trigger)) {
- hadd SearchBOT.settings trigger $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,trigger) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,indexchan)) {
- hadd SearchBOT.settings indexchan $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,indexchan) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,maxresults)) {
- hadd SearchBOT.settings maxresults $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,maxresults) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,release.trigger)) {
- hadd SearchBOT.settings release.trigger $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,release.trigger) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,release.time)) {
- hadd SearchBOT.settings release.time $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,release.time)
- }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,flood)) {
- hadd SearchBOT.settings flood $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,flood) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,floodtime)) {
- hadd SearchBOT.settings floodtime $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,floodtime) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,ignore)) {
- hadd SearchBOT.settings ignore $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,ignore) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,failed.searches)) {
- hadd SearchBOT.settings failed.searches $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,failed.searches) }
- if ($readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,successful.searches)) {
- hadd SearchBOT.settings successful.searches $readini($+(",$scriptdirSearchBOT.ini,"),n,SearchBOT,successful.searches) }
- mkdir $+(",$scriptdir,update,") | mkdir $+(",$scriptdir,backup,")
- if (!$hget(SearchBOT.settings,default)) {
- hadd -m SearchBOT.settings default This is the Default Advertisement. Please have someone create a custom advertisement for your channel. }
- sb.findhashes
- }
- ;# Alias to save indexes stored in hash tables to hard drive.
- alias sb.saveindexes { hsave -i SearchBOT.settings $+(",$scriptdir,SearchBOT.ini,") SearchBOT
- if (!$isdir($+(",$scriptdir,data,"))) mkdir $+(",$scriptdir,data,")
- var %x = 1
- while ( %x <= $hget(0) ) {
- if ( $gettok($hget(%x),1,46) == SearchBOT ) && ( $gettok($hget(%x),2,46) != settings ) && ( $gettok($hget(%x),2,46) != search ) && ( $gettok($hget(%x),2,46) != sessions ) && ( $gettok($hget(%x),2,46) != flood ) {
- .hsave -o $hget(%x) $+(",$scriptdir,data\,$mkfn($hget(%x)),.dat,")
- }
- inc %x
- }
- }
- ;# Alias to find stored hash tables.
- alias sb.findhashes { var %x = 1
- while ( %x <= $findfile($+(",$scriptdir,data/,"),*.dat,0) ) {
- .echo -q $findfile($+(",$scriptdir,data/,"),*.dat,%x,sb.makehashes $1-)
- inc %x
- }
- }
- ;# Alias to make the hash tables and load any indexes that have been stored on the hard drive
- alias sb.makehashes {
- if (*#* iswm $nopath($1-)) {
- if ($istok($hget(SearchBOT.settings,indexchan),$wildtok($nopath($1-),#*,1,46),44)) {
- hmake $left($nopath($1-),-4)
- hload $left($nopath($1-),-4) $+(",$1-,")
- }
- }
- ; if ( $gettok($left($nopath($1-),-4),2,46) == settings ) halt
- else {
- hmake $left($nopath($1-),-4)
- hload $left($nopath($1-),-4) $+(",$1-,")
- }
- }
- ;# Alias to perfrom when closing the SearchBOT.
- alias sb.close {
- sb.saveindexes
- if ($hget(SearchBOT.settings,enable) == 1) writeini $+(",$scriptdirSearchBOT.ini,") SearchBOT enable $hget(SearchBOT.settings,enable)
- writeini $+(",$scriptdirSearchBOT.ini,") SearchBOT trigger $hget(SearchBOT.settings,trigger)
- writeini $+(",$scriptdirSearchBOT.ini,") SearchBOT indexchan $hget(SearchBOT.settings,indexchan)
- writeini $+(",$scriptdirSearchBOT.ini,") SearchBOT maxresults $hget(SearchBOT.settings,maxresults)
- writeini $+(",$scriptdirSearchBOT.ini,") SearchBOT releasetrig $hget(SearchBOT.settings,release.trigger)
- writeini $+(",$scriptdirSearchBOT.ini,") SearchBOT releasetime $hget(SearchBOT.settings,release.time)
- writeini $+(",$scriptdirSearchBOT.ini,") SearchBOT flood $hget(SearchBOT.settings,flood)
- writeini $+(",$scriptdirSearchBOT.ini,") SearchBOT floodtime $hget(SearchBOT.settings,floodtime)
- writeini $+(",$scriptdirSearchBOT.ini,") SearchBOT ignore $hget(SearchBOT.settings,ignore)
- unset %SearchBOT.*
- }
- ;# Alias to check release times of things in the new releases hash table. Removes outdated items.
- alias sb.checkreleasetimes {
- if ($hget($+(SearchBOT.,$1,.newreleases),0).item == 0) halt
- else { var %x = 1
- while ( %x <= $hget($+(SearchBOT.,$1,.newreleases),0).item) {
- if ($hget($+(SearchBOT.,$1,.newreleases),%x).item >= $calc($ctime - $hget(SearchBOT.settings,release.time))) {
- hdel $+(SearchBOT.,$1,.newreleases) $hget($+(SearchBOT.,$1,.newreleases),%x).item
- }
- inc %x
- }
- }
- }
- ;###################
- ;# Searching Aliases
- ;###################
- ;# test alias
- alias sb.search {
- if ($remove($3-,*,?) == $null) || ($len($remove($3-,*,?)) < 2) {
- .msg $2 Please use a more specific search string.
- halt
- }
- else { hadd -m SearchBOT.search $+($2,.searchstring) $+(*,$replace($3-,$chr(32),$chr(42)),*)
- var %x = 1, %z = 1
- while (%z <= $hget(0)) {
- if (SearchBOT.#* !iswm $hget(%z)) || ($hget(%z) == SearchBOT.search) { inc %z | continue }
- else {
- if ($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),0,w).data == 0) { inc %z | continue }
- else {
- hinc SearchBOT.search $+($2,.allresults) $hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),0,w).data
- hinc SearchBOT.search $+($2,.chans)
- inc %z
- }
- }
- }
- var %x = 1, %z = 1
- while (%z <= $hget(0)) {
- if (SearchBOT.#* !iswm $hget(%z)) || ($hget(%z) == SearchBOT.search) { inc %z | continue }
- else {
- if ($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),0,w).data == 0) { inc %z | continue }
- else {
- while (%x <= $hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),0,w).data) {
- if ($hget(SearchBOT.search,$+($2,.totalresults)) >= $hget(SearchBOT.settings,maxresults)) { goto truncated }
- hinc SearchBOT.search $+($2,.totalresults)
- if ($gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,1,46) ison $gettok($hget(%z),2,46)) { hinc SearchBOT.search $+($2,.online)
- if ($1 == all) { .msg $2 - ONLINE - Channel: $gettok($hget(%z),2,46) Nick: $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,1,46) Ad: $hget(%z,$hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data) -- Use: /ctcp $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,1,46) xdcc send $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,2,46) }
- if ($1 == online) { .msg $2 - ONLINE - Channel: $gettok($hget(%z),2,46) Nick: $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,1,46) Ad: $hget(%z,$hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data) -- Use: /ctcp $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,1,46) xdcc send $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,2,46) }
- }
- else { hinc SearchBOT.search $+($2,.offline)
- if ($1 == offline) { .msg $2 - OFFLINE - Channel: $gettok($hget(%z),2,46) Nick: $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,1,46) Ad: $hget(%z,$hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data) -- Use: /ctcp $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,1,46) xdcc send $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,2,46) }
- if ($1 == all) { .msg $2 - OFFLINE - Channel: $gettok($hget(%z),2,46) Nick: $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,1,46) Ad: $hget(%z,$hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data) -- Use: /ctcp $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,1,46) xdcc send $gettok($hfind($hget(%z),$hget(SearchBOT.search,$+($2,.searchstring)),%x,w).data,2,46) }
- }
- inc %x
- }
- }
- inc %z
- }
- }
- goto end
- :truncated
- .msg $2 Your results have been restricted to the first $hget(SearchBOT.settings,maxresults) results.
- goto end
- :end
- if ($hget(SearchBOT.search,$+($2,.totalresults)) == 0) || ($hget(SearchBOT.search,$+($2,.totalresults)) == $null) { .msg $2 Sorry No packs were found that matched $+(",$3-,") | hinc SearchBOT.settings failed.searches }
- else { .msg $2 End of results. Total Packs: $iif($hget(SearchBOT.search,$+($2,.allresults)),$hget(SearchBOT.search,$+($2,.allresults)),0) Results: $iif($hget(SearchBOT.search,$+($2,.totalresults)),$hget(SearchBOT.search,$+($2,.totalresults)),0) Online: $iif($hget(SearchBOT.search,$+($2,.online)),$hget(SearchBOT.search,$+($2,.online)),0) Offline: $iif($hget(SearchBOT.search,$+($2,.offline)),$hget(SearchBOT.search,$+($2,.offline)),0) - On $hget(SearchBOT.search,$+($2,.chans)) Channel(s). | hinc SearchBOT.settings successful.searches }
- hdel -w SearchBOT.search $+($2,*)
- }
- }
- ;# Allows people to see what new releases are avaiable. Useage= sb.newreleases $nick
- alias sb.newreleases {
- if ($hget(NewReleases,0).item == 0) .msg $1 There are No New releases listed.
- else {
- .msg $1 There are currently $hget(NewReleases,0).item New Releases Listed.
- set $+(%,$1) 1
- while ( $($+(%,$1),2) <= $hget(NewReleases,0).item ) {
- .msg $1 New Release $($+(%,$1),2) : $hget(NewReleases,$($+(%,$1),2)).data
- inc $+(%,$1)
- }
- }
- unset set $+(%,$1)
- }
- ;################
- ;# Pack Aliases
- ;################
- ;# Adds a pack. Useage= sb.addpack $chan $nick $strip($remove($wildtok($1-,*#*,1,32),$chr(91),$chr(93)),burc) $strip($1-,burc)
- alias sb.addpack {
- echo -st [9Working]-[9Added] $+(3,$1,) 4@ $+(07,$2,.,$3,) $+(15,$4-,)
- hadd -m $+(SearchBOT.,$1) $+($2,.,$3) $4-
- }
- ; Returns Total Packs Indexed on all channels. And Number of Channels Indexed. Useage= msg $nick $sb.countpacks
- alias sb.countpacks {
- if (!$1) { var %x = 1, %numpacks = 0
- while ( %x <= $numtok($hget(SearchBOT.settings,indexchan),44)) {
- inc %numpacks $hget($+(SearchBOT.,$gettok($hget(SearchBOT.settings,indexchan),%x,44)),0).item
- inc %x
- }
- return %numpacks
- }
- elseif ($1) {
- if ($left($1,1) != $chr(35)) { return Error: You must specify a channel. }
- if (!$hget($+(SearchBOT.,$1))) { return No Packs are currently indexed for $+(",$1,") }
- else { Return $hget($+(SearchBOT.,$1),0).item }
- }
- }
- ;#################
- ;# Control Aliases
- ;#################
- ;# Disables the SearchBOT Remotely. No Paramaeters.
- alias sb.disableSearchBOT {
- hadd SearchBOT.settings enable 0
- msg %SearchBOT.searchchan This SearchBOT is now offline.
- }
- ;# Enables the SearchBOT Remotely. No Parameters.
- alias sb.enableSearchBOT {
- hadd SearchBOT.settings enable 1
- msg %SearchBOT.searchchan This SearchBOT is now online Indexing channel(s): $replace($hget(SearchBOT.settings,indexchan),$chr(44),$chr(32)) Trigger(s): $replace($hget(SearchBOT.settings,trigger),$chr(44),$chr(32))
- }
- ;# Used to validae logins. Useage= msg $nick $sb.login($1,$nick)
- alias sb.login { var %x = 1
- if ( $hget(SearchBOT.sessions,$2) ) {
- return You are already logged in with $+(",$hget(SearchBOT.sessions,$2),") - Please logout before logging in with a different access.
- }
- while ( %x <= $ini($+(",$scriptdir,SearchBOT.ini"),passwords,0) ) {
- if ( $1 === $readini($+(",$scriptdir,SearchBOT.ini"),passwords,$ini($+(",$scriptdir,SearchBOT.ini"),passwords,%x)) ) {
- hadd -mu1800 SearchBOT.sessions $2 $ini($+(",$scriptdir,SearchBOT.ini"),passwords,%x)
- return You now have $+(",$ini($+(",$scriptdir,SearchBOT.ini"),passwords,%x),") access. This bot will recognize you from your nick $+(",$2,") for the next 30 Minutes, or the bot is restarted.
- }
- inc %x
- }
- return Password Incorrect. You are not Logged in.
- }
- ;# Used to log yourself out. Useage= msg $nick $sb.logout($nick)
- alias sb.logout {
- if (!$hget(SearchBOT.sessions,$1)) { return Error: You are not currently Logged In. }
- else {
- hdel SearchBOT.sessions $1
- return You are now logged out. You must login again before you will have any bot control.
- }
- }
- ;# Alias to change passwords. Useage msg $nick $sb.changepass(level,newpass)
- alias sb.changepass {
- if ( $istok(op admin owner,$1,32) ) {
- writeini $+(",$scriptdir,SearchBOT.ini,") passwords $1 $2
- return You have changed the password for $+(",$1,") to $+(",$2,")
- }
- else { return Error: You must specify a level (op admin owner) and a password. }
- }
- ;# Alias to get a password.
- alias sb.getpass {
- if ( $istok(op admin owner,$1,32) ) { return The password for $+(",$1,") is $+(",$readini($+(",$scriptdir,SearchBOT.ini,"),passwords,$1),") }
- else { return Error: You must specify a level (op admin owner) }
- }
- ;# alias to get a list of sessions.
- alias sb.sessions {
- hsave -iu SearchBOT.sessions $+(",$scriptdir,sessions.tmp,") sessions
- var %x = 1
- while ( %x <= $ini($+(",$scriptdir,sessions.tmp,"),sessions,0) ) {
- .msg $1 $+(",$ini($+(",$scriptdir,sessions.tmp,"),sessions,%x),") is logged in as $+(",$readini($+(",$scriptdir,sessions.tmp,"),sessions,$ini($+(",$scriptdir,sessions.tmp,"),sessions,%x)),")
- inc %x
- }
- .remove $+(",$scriptdir,sessions.tmp,")
- .msg $1 End of Sessions.
- }
- ;# Alias to log another user out. Useage= msg $nick $sb.disconnect(*!ident@host)
- alias sb.disconnect {
- if (!$hget(SearchBOT.sessions,$1)) { return Error: $+(",$1,") is not currently logged in. }
- else {
- .hdel SearchBOT.sessions $1
- return User $+(",$1,") has been disconnected.
- }
- }
- ;# Returns true if someone is listed in a channel's index. Useage= msg $nick $sb.findserver(#channel,$nick)
- alias sb.findserver {
- if ( !$hget($+(SearchBOT.,$1)) ) { return $1 does not currently have an index. }
- elseif ( $hfind($+(SearchBOT.,$1),$+($2,.*),0,w) < 1 ) { return $2 does not have any packets listed on $1 }
- else { return $2 has $hfind($+(SearchBOT.,$1),$+($2,.*),0,w) packets listed on $1 }
- }
- ;# Used To delete nicks from an index. Useage= msg $nick $sb.delserver(#channel,$nick)
- alias sb.delserver {
- if ( !$hget($+(SearchBOT.,$1)) ) { return $1 does not currently have an index. }
- elseif ( $hfind($+(SearchBOT.,$1),$+($2,.*),0,w) < 1 ) { return $2 does not have any packets listed on $1 }
- else {
- hdel -w $+(SearchBOT.,$1) $+($2,.*)
- return $2 has been deleted from the index of $1
- }
- }
- ;#############################
- ;# Channel Indexing Functions.
- ;#############################
- ;# Used to add a channel to index. Useage= msg $nick $sb.addchan(#channel)
- alias sb.addchan {
- if ( $left($1,1) != $chr(35) ) { return Error: You must specify a channel. }
- if ($istok($hget(SearchBOT.settings,indexchan),$1,44)) { return Error: $+(",$1,") is currently being indexed. }
- else {
- hadd SearchBOT.settings indexchan $addtok($hget(SearchBOT.settings,indexchan),$1,44)
- join $1
- if (!hget($+(SearchBOT.,$1))) { hmake $+(SearchBOT.,$1) 50 }
- if ( $exists($+(",$scriptdir,data/,SearchBOT.,$1,.dat,")) ) { hload $+(SearchBOT.,$1) $+(",$scriptdir,data/,SearchBOT.,$1,.dat,") }
- if ( $exists($+(",$scriptdir,data/,SearchBOT.,$1,newreleases.dat,")) ) {
- hmake $+(SearchBOT.,$1,.newreleases)
- hload $+(SearchBOT.,$1,.newreleases) $+(",$scriptdir,data/,SearchBOT.,$1,newreleases.dat,")
- }
- return $+(",$1,") has been added to the channels this bot is indexing.
- }
- }
- ;# Used to delete an index channel. Useage= msg $nick $sb.delchan(#channel,$nick)
- alias sb.delchan {
- if ( $left($1,1) != $chr(35) ) { return Error: You must specify a channel. }
- if (!$istok($hget(SearchBOT.settings,indexchan),$1,44)) { return Error: $+(",$1,") is not currently being indexed. }
- else {
- hadd SearchBOT.settings indexchan $remtok($hget(SearchBOT.settings,indexchan),$1,1,44)
- part $1 I am no longer indexing this channel at the request of $+(",$2,")
- if ($hget($+(SearchBOT.,$1))) {
- hsave -o $+(SearchBOT.,$1) $+(",$scriptdir,data/,SearchBOT.,$1,.dat,")
- hfree $+(SearchBOT.,$1)
- }
- return $+(",$1,") has been deleted from my my index channels.
- }
- }
- ;# Used to add a search trigger. Useage: msg $nick $sb.addtrig(trigger)
- alias sb.addtrig {
- if ($istok($hget(SearchBOT.settings,trigger),$1,44)) { return Error: $+(",$1,") is already being used as a trigger }
- hadd SearchBOT.settings trigger $addtok($hget(SearchBOT.settings,trigger),$1,44)
- return $+(",$1,") successfully added. Current triggers: $hget(SearchBOT.settings,trigger)
- }
- ;# Used to delete a search trigger. Useage: msg $nick $sb.deltrig(trigger)
- alias sb.deltrig {
- if (!$istok($hget(SearchBOT.settings,trigger),$1,44)) { return Error: $+(",$1,") is not being used as a trigger }
- hadd SearchBOT.settings trigger $remtok($hget(SearchBOT.settings,trigger),$1,1,44)
- return $+(",$1,") successfully deleted. Current triggers: $hget(SearchBOT.settings,trigger)
- }
- ;#########################
- ;# New Releases Functions.
- ;#########################
- ;# Used to add a New Release to a channel. Useage: /msg $nick $sb.addrelease(#channel,release)
- alias sb.addrelease {
- if ($left($1,1) != $chr(35)) { return Error: You must specify a channel. }
- if (!$istok($hget(SearchBOT.settings,indexchan),$1,44)) { return Error: I am not currently indexing $+(",$1,") }
- if ($hget($+(SearchBOT.,$1,.newreleases),$2)) { return Error: $+(",$2,") is already listed as a new release on $+(",$1,") }
- else {
- hadd -m $+(SearchBOT.,$1,.newreleases) $ctime $2
- return $+(",$2,") successfully added as a new release for $+(",$1,") and will be automatically deleted $asctime($calc($ctime + %SearchBOT.releasetime),HH:mm:ss mmm dd yyyy)
- }
- }
- ;# Used to list releases for a channel. Useage= /sb.listrelease $channel $nick
- alias sb.listreleases {
- if ($left($1,1) != $chr(35)) { .msg $2 Error: You must specify a channel. }
- if ( $hget($+(SearchBOT.,$1,.newreleases),0).item == 0 ) || (!$hget($+(SearchBOT.,$1,.newreleases))) { .msg $2 No releases are listed for $+(",$1,") }
- else { var %x = 1
- .msg $nick Listing New Releases for $+(",$1,")
- while (%x <= $hget($+(SearchBOT.,$1,.newreleases),0).item) {
- .msg $2 $+(",$hget($+(SearchBOT.,$1,.newreleases),%x).data,") to be deleted $+(",$asctime($calc($hget($+(SearchBOT.,$1,.newreleases),%x).item + %SearchBOT.releasetime),HH:mm:ss mmm dd yyyy),")
- inc %x
- }
- .msg $2 End Of Listing.
- }
- }
- ;# Used to delete a release for a channel manually. Useage= /msg $nick $sb.delrelease(#channel,release text)
- alias sb.delrelease {
- if ($left($1,1) != $chr(35)) { return Error: You must specify a channel. }
- if ( $hget($+(SearchBOT.,$1,.newreleases),0).item == 0 ) || (!$hget($+(SearchBOT.,$1,.newreleases))) { return No releases are listed for $+(",$1,") }
- if (!$hfind($+(SearchBOT.,$1,.newreleases),$2,1).data) { return Error: $+(",$2,") is not in the release list for $+(",$1,") }
- else {
- hdel $+(SearchBOT.,$1,.newreleases) $hfind($+(SearchBOT.,$1,.newreleases),$2,1).data
- return $+(",$2,") successfully deleted from the listing for $+(",$1,")
- }
- }
- ;# Used to list releases for a certain channel. sb.listreleases #channel nick
- alias sb.listreleases {
- if ( $left($1,1) != $chr(35)) { return Error: You must specify a channel. }
- elseif (!$hget($+(SearchBOT.,$1,.newreleases))) { return There are currently no new releases listed for $+(",$1,") }
- else {
- hsave -i $hget($+(SearchBOT.,$1,.newreleases)) $+(",$scriptdir,$1,.newreleases.tmp") releases
- .play -treleases $2 $+(",$scriptdir,$1,.newreleases.tmp")
- }
- }
- ;#######################
- ;# Advertisement Aliases
- ;#######################
- ;# Used to find a channels advertisement. Uses defualt one if it cant find one. $sb.getadvert(#channel)
- alias sb.getadvert {
- if ( $left($1,1) != $chr(35)) { return Error: You must specify a channel name. }
- if (!$hget(SearchBOT.settings)) { return Error: Settings Table not found. }
- if (!$hget(SearchBOT.settings,$+($1,.advert))) {
- if (!$hget(SearchBOT.settings,default.advert)) { return Error: No advertisment found for $+(",$1,") Default advert not found. }
- else { return Default advertisement of $+(",$hget(SearchBOT.settings,default.advert),") is being used for $+(",$1,") }
- }
- else { return Advertisement for $+(",$1,") is set to $+(",$hget(SearchBOT.settings,$+($1,.advert)),") }
- }
- ;# Sets the advertisment for a specified channel or the defualt. $sb.setadvert(#channel,new ad)
- alias sb.setadvert {
- if ($1 == default) {
- hadd -m SearchBOT.settings default.advert $2-
- return Default Advertisment successfully set to $+(",$2-,")
- }
- if ($left($1,1) != $chr(35)) { return Error: You must specify a channel. }
- else {
- hadd -m SearchBOT.settings $+($1,.advert) $2-
- return Advert for $+(",$1,") sucessfully set to $+(",$2,")
- }
- }
- ;# Deletes an advert for a specified channel or defualt. $sb.deladvert(#channel)
- alias sb.deladvert {
- if ($1 == default) {
- hdel SearchBOT.settings default.advert
- return Default Advertisment successfully deleted.
- }
- if ($left($1,1) != $chr(35)) { return Error: You must specify a channel. }
- else {
- hdel SearchBOT.settings $+($1,.advert)
- if ($timer($+($1,.advert))) { $+(.timer,$1,.advert) off }
- return Advert for $+(",$1,") sucessfully deleted and stopped.
- }
- }
- ;# Formats the advertisment to replace substitution words. $sb.formatadvert(#channel)
- alias sb.formatadvert {
- if ( $left($1,1) != $chr(35)) { return Error: You must specify a channel with this command. }
- if (!$hget(SearchBOT.settings,$+($1,.advert))) {
- if ($hget(SearchBOT.settings,default.advert)) { return $sb.subadvert($hget(SearchBOT.settings,default.advert)) }
- else { return No advert set for $+(",$1,"). Default Advert not found. }
- }
- else { return $sb.subadvert($hget(SearchBOT.settings,$+($1,.advert))) }
- }
- ;# Performs substitutions for advert. $sb.subadvert(advert)
- alias sb.subadvert { return $replace($1-,[triggers],$+(",$replace($hget(SearchBOT.settings,trigger),$chr(44),$+($chr(32),or,$chr(32))),"),[indexchans],$+(",$hget(SearchBOT.settings,indexchan),")) }
- ;# Sets an advertisement time.
- alias sb.setadtime {
- if ( $left($1,1) != $chr(35)) { return Error: You must specify a channel with this command. }
- if ($2 !isnum) { Return Error: You must specify a time in seconds. /msg $me setadtime #channel 300 - would make a 5 minute advert. }
- if (!$hget(SearchBOT.settings,default.advert)) && (!$hget(SearchBOT.settings,$+($1,.advert))) { return Error: You must either set a Default Advertisement or a Custom Channel Advertisement. }
- else {
- if ($me !ison $1) { return Error: I am not currently on $+(",$1,") so I cannot run an advertisement on that channel. }
- else {
- hadd SearchBOT.settings $+($1,.adtime) $2
- $+(.,timer,$1,.advert) 0 $hget(SearchBOT.settings,$+($1,.adtime)) .msg $1 $sb.formatadvert($1)
- return Ad Time for $+(",$1,") successfully set to $+(",$duration($2),")
- }
- }
- }
- ;# Returns the adtime. /msg $nick $sb.getadtime(#channel)
- alias sb.getadtime {
- if ($left($1,1) != $chr(35)) { return Error: You must specify a channel. }
- if (!$hget(SearchBOT.settings,$+($1,.adtime))) { return Error: There is no advert time set for $+(",$1,") }
- else { return Current Advert time for $+(",$1,") set to $+(",$duration($hget(SearchBOT.settings,$+($1,.adtime))),") }
- }
- ;#################
- ;# Request Aliases
- ;#################
- ;# Alias to Add a request.
- alias sb.addrequest {
- if ( $hfind(SearchBOT.requests,$1-).data) { return Error: You have already placed that request at $asctime($hfind(SearchBOT.requests,$1-).data) }
- hadd -m SearchBOT.requests $ctime $1-
- return Your request has been added on $+(-,$asctime,-)
- }
- ;# Alias to list requests.
- alias sb.listrequests {
- if (!$hget(SearchBOT.requests)) || ($hget(SearchBOT.requests,0).item == 0) { .msg $1 No requests are currently stored. }
- else {
- write -c $+(",$scriptdir,requests.txt,") Current Requests are:
- var %x = 1
- while (%x <= $hget(SearchBOT.requests,0).item) {
- write $+(",$scriptdir,requests.txt,") $+(#,%x) - $gettok($hget(SearchBOT.requests,%x).data,2-,32) - Requested By $gettok($hget(SearchBOT.requests,%x).data,1,32) on $asctime($hget(SearchBOT.requests,%x).item)
- inc %x
- }
- write $+(",$scriptdir,requests.txt,") If you can fill any of these requests please do.
- .play $1 $+(",$scriptdir,requests.txt,")
- }
- }
- ;# Alias to delete a request.
- alias sb.delrequest {
- if (!$hget(SearchBOT.requests)) { return Error: No Requests are currently found on this bot. }
- elseif (!$hfind(SearchBOT.requests,$+(*,$1-),1,w).data) { return Error: $+(",$1-,") was not found in the requests. }
- else {
- hdel SearchBOT.requests $hfind(SearchBOT.requests,$+(*,$1-),1,w).data
- return $+(",$1,") Has successfully been deleted.
- }
- }
- ;#################
- ;# Ignore Aliases
- ;#################
- ;# Alias to list ingored hosts
- alias sb.listignored {
- if ( $ignore(0) == 0 ) { .msg $1 There are currently no ignores set. }
- else {
- write -c $+(",$scriptdir,ignore.txt,")
- var %x = 1
- while ( %x <= $ignore(0) ) {
- write $+(",$scriptdir,ignore.txt,") Nick: $gettok($ignore(%x),1,33) Type: $ignore(%x).type Unset in: $duration($ignore(%x).secs)
- inc %x
- }
- .play $1 $+(",$scriptdir,ignore.txt,")
- }
- }
- ;# Alias to remove an ignore
- alias sb.delignore {
- if (!$ignore($+($1,!*@*))) { return Error: That nick is not ignored. }
- else {
- ignore -r $+($1,!*@*)
- return $+(",$1,") Successfully unignored
- }
- }
- ;################
- ;# Backup Aliases
- ;################
- ;# Alias to list all Backedup script files. Found in /backup
- alias sb.listbackups {
- if ( $findfile($+(",$scriptdir,backup/,"),*.mrc,0) == 0 ) { .msg $1 No Backedup Scripts found. }
- else { var %x = 1
- .write -c $+(",$scriptdir,backups.txt,") Backed Up SearchBOT Scripts.
- while ( %x <= $findfile($+(",$scriptdir,backup/,"),*.mrc,0) ) {
- .write $+(",$scriptdir,backups.txt,") $nopath($findfile($+(",$scriptdir,backup/,"),*.mrc,%x))
- inc %x
- }
- .write $+(",$scriptdir,backups.txt,") End of Backups
- .play $1 $+(",$scriptdir,backups.txt,")
- }
- }
- ;# Alias to restore a backedup script.
- alias sb.restorebackup {
- if ($findfile($+(",$scriptdir,backup/,"),$2-,1) == 0 ) { .msg $1 $+(",$2-,") Was not found in my backups. }
- else {
- .msg $1 Script Is being rerstored. It may take a few secoonds.
- .timerunloadSearchBOT 1 2 unload -rs SearchBOT.mrc
- .timerbackupscript 1 2 .copy $+(",$scriptdir,SearchBOT.mrc,") $+(",$scriptdir,backup/,$asctime(mmm-dd-yyyy-HH-mm-ss),-SearchBOT.mrc,")
- .timercopyscript 1 2 .copy -o $+(",$scriptdir,backup/,$2-,") $+(",$scriptdir,SearchBOT.mrc,")
- .timerreloadscript 1 2 load -rs $+(",$scriptdir,SearchBOT.mrc,")
- .timermsgnick 1 2 .msg $1 Script Restored and Reloaded
- }
- }
- ;#################
- ;# Misc. Aliases
- ;#################
- ;# Checks if a new trigger is a command. When commands are added they must be added here as well to prevent search trigger conflicts.
- alias sb.iscommand { if ($istok(Triggers online offline Login Logout Changepass Getpass Sessions Dissconnect Delnick Addchan Delchan Listreleases Delrelease Setadvert Getadvert Deladvert Setadtime Info Listchans Addtrig Deltrig Addrelease Seeadvert Getadtime Countpacks,$1,32)) { return true } }
- ;# checks if anyone is using a file for a play. If they arent it deletes the file.
- alias sb.playcheck { var %x = 1
- while ( %x <= $play(0)) { if ($play(%x).fname == $1- ) { return true } | inc %x }
- }
- ;# Alias to change flood settings.
- alias sb.flood {
- if ($1 !isnum ) { return Error: You may only specify a number with this command. }
- else {
- if ($prop == flood) {
- hadd SearchBOT.settings flood $1
- return Amount of messages to trigger flood have been changed to $+(",$1,").
- }
- elseif ($prop == floodtime) {
- hadd SearchBOT.settings floodtime $1
- return The flood time has been changed to $+(",$1,").
- }
- elseif ($prop == ignoretime) {
- hadd SearchBOT.settings ignore $1
- return The ignore time for a user who floods the bot has been changed to $+(",$1,").
- }
- }
- }
- ;# alias to change the max results setting
- alias sb.maxresults {
- if ($1 !isnum ) { Return Current Max Results: $+(",$hget(SearchBOT.settings,maxresults),") Please specify a number with this command to change it. }
- elseif ( $1 == $hget(SearchBOT.settings,maxresults) ) { return Error: Your parameter matches the current setting. }
- else {
- hadd SearchBOT.settings maxresults $1
- return Max results set to $+(",$1,").
- }
- }
- ;# Alias to total up searches
- alias sb.searchcount {
- .msg $1 Failed Searches: $iif($hget(SearchBOT.settings,failed.searches),$hget(SearchBOT.settings,failed.searches),0)
- .msg $1 Successful Searches: $iif($hget(SearchBOT.settings,successful.searches),$hget(SearchBOT.settings,successful.searches),0)
- .msg $1 Total Searches: $calc( $iif($hget(SearchBOT.settings,failed.searches),$hget(SearchBOT.settings,failed.searches),0) + $iif($hget(SearchBOT.settings,successful.searches),$hget(SearchBOT.settings,successful.searches),0) )
- }
- ;###################
- ;# On Text Events
- ;# #################
- on *:text:*:?: {
- if ($hget(SearchBOT.settings,enable) == 1) { .closemsg $nick
- ;# Anti-Flood Event.
- if (!$hget(SearchBOT.sessions,$nick)) { hinc $+(-,mu,$hget(SearchBOT.settings,floodtime)) SearchBOT.flood $nick
- if ($hget(SearchBOT.flood,$nick) >= $hget(SearchBOT.settings,flood)) { .ignore $+(-,pcdinktu,$hget(SearchBOT.settings,ignore)) $nick | .closemsg $nick | hdel SearchBOT.flood $nick
- .msg $nick You have activated flood protect... and will be actively ignored for $+(07,$duration($hget(SearchBOT.settings,ignore)),...) enjoy ;)
- halt
- }
- }
- if ($chr(124) isin $1-) { .msg $nick Please do not include $+(",$chr(124),") in your messages. | halt }
- ;*** /msg $me HELP
- elseif (help isin $1) {
- if (!$hget(SearchBOT.sessions,$nick)) { .play -tallusers $nick $+(",$scriptdir,SearchBOT.mrc,") }
- elseif ($hget(SearchBOT.sessions,$nick) == owner) {
- .play -tallusers $nick $+(",$scriptdir,SearchBOT.mrc,")
- .play -towner $nick $+(",$scriptdir,SearchBOT.mrc,")
- .play -tadmin $nick $+(",$scriptdir,SearchBOT.mrc,")
- .play -top $nick $+(",$scriptdir,SearchBOT.mrc,")
- }
- elseif ($hget(SearchBOT.sessions,$nick) == admin) {
- .play -tallusers $nick $+(",$scriptdir,SearchBOT.mrc,")
- .play -tadmin $nick $+(",$scriptdir,SearchBOT.mrc,")
- .play -top $nick $+(",$scriptdir,SearchBOT.mrc,")
- }
- elseif ($hget(SearchBOT.sessions,$nick) == op) {
- .play -tallusers $nick $+(",$scriptdir,SearchBOT.mrc,")
- .play -top $nick $+(",$scriptdir,SearchBOT.mrc,")
- }
- halt
- }
- ;*** Lists Triggers
- elseif ($1 == triggers) {
- .msg $nick The Current Search triggers are $+(",$replace($hget(SearchBOT.settings,trigger),$chr(44),$+($chr(32),or,$chr(32))),") New Release Triggers - $+(",$replace(%SearchBOT.newrelease.triggers,$chr(44),$+($chr(32),or,$chr(32))),") followed by the channel you would like to see new releases for.
- halt
- }
- ;*** Search Events.
- elseif ($hget(SearchBOT.settings,enable) == 1) {
- ;*** Searches all packs
- if ($istok($hget(SearchBOT.settings,trigger),$1,44)) {
- if ($2) { sb.search all $nick $2- }
- else { .msg $nick Please Specify A Search String. }
- halt
- }
- ;*** Searches offline packs
- elseif (offline isin $1) {
- if ($2) { sb.search offline $nick $2- }
- else { .msg $nick Please Specify A Search String. }
- halt
- }
- ;*** Searches online packs
- elseif (online isin $1) {
- if ($2) { sb.search online $nick $2- }
- else { .msg $nick Please Specify A Search String. }
- halt
- }
- }
- ;*** New release Listing.
- elseif ($istok($hget(SearchBOT.settings,release.trigger),$1,44)) {
- if (!$2) { .msg $nick You must specify a channel to lookup releases for. }
- else { sb.listreleases $2 $nick }
- halt
- }
- ;*** Lets a user add a request.
- elseif ($1 == !request) && ($hget(SearchBOT.settings,requests.enable) == 1) {
- if (!$2) { .msg $nick You must include text for a request. }
- else { .msg $nick $sb.addrequest($nick $2-) }
- halt
- }
- ;*** Lists all requests.
- elseif ($1 == !requests) && ($hget(SearchBOT.settings,requests.enable) == 1) { sb.listrequests $nick | halt }
- }
- ;*** Login Event.
- if ($1 == login) {
- if (!$2) { .msg $nick You MUST specify a password. }
- else { .msg $nick $sb.login($2,$nick) }
- halt
- }
- ;*** Logout Event
- elseif ($1 == logout) { .msg $nick $sb.logout($nick) | halt }
- ;*** Stops access to all following commands if the person is not logged in.
- elseif (!$hget(SearchBOT.sessions,$nick)) && ($hget(SearchBOT.settings,enable) == 1) {
- .msg $nick Error: You have either typed an unrecognized command or you must login before using any commands beyond the basic search functions. Please use /msg $me $gettok($hget(SearchBOT.settings,trigger),1,44) *search term*
- halt
- }
- ;*** Control Access
- ;* Checks if the user is logged in to get access to all following commands.
- elseif ($hfind(SearchBOT.sessions,$nick)) {
- ;*** Owner section - Checks if you are an owner. Limits Commands nested in this if to an owner.
- if ($hget(SearchBOT.sessions,$nick) == owner) {
- ;*** Change login passwords
- elseif ($1 == changepass) {
- if (!$2) || (!$3) { .msg $nick Useage: /msg $me changepass level (op admin owner) newpass }
- else { .msg $nick $sb.changepass($2,$3) }
- }
- ;*** Get login passwords
- elseif ($1 == getpass) {
- if (!$2) { .msg $nick Useage: /msg $me getpass level (op admin owner) }
- else { .msg $nick $sb.getpass($2) }
- }
- ;*** Lists all logged in sessions
- elseif ($1 == sessions) { sb.sessions $nick }
- ;# Disconnects a logged in session
- elseif ($1 == disconnect) {
- if (!$2) { .msg $nick Useage: /msg $me disconnect *!ident@host }
- else { .msg $nick $sb.disconnect($2) }
- }
- ;# Rehashes the startup events.
- elseif ($1 == rehash) { sb.startup }
- elseif ($1 == listbackups) { sb.listbackups $nick }
- elseif ($1 == restorebackup) {
- if (!$2) { .msg $nick Error: You must specify the filename to restore. }
- else { sb.restorebackup $nick $2- }
- }
- elseif ($1 == flood) {
- if (!$2) { .msg $nick You must specify a number for this command. }
- else { .msg $nick $sb.flood($2).flood }
- }
- elseif ($1 == floodtime) {
- if (!$2) { .msg $nick You must specify a number for this command. }
- else { .msg $nick $sb.flood($2).floodtime }
- }
- elseif ($1 == ignoretime) {
- if (!$2) { .msg $nick You must specify a number for this command. }
- else { .msg $nick $sb.flood($2).ignoretime }
- }
- elseif ($1 == maxresults) {
- if (!$2) || ($2 !isnum) { .msg $nick You must specify a number for this command. }
- else { .msg $nick $sb.maxresults($2) }
- }
- }
- ;*** Admin Section - Checks if you are an owner or admin. Limits Commands nested in this if to an owner or admin.
- if ($hget(SearchBOT.sessions,$nick) == admin) || ($hget(SearchBOT.sessions,$nick) == owner) {
- ;*** Deletes all of a nicks entries out of a channel's index.
- if ($1 == delnick) {
- if ($left($2,1) != $chr(35)) { .msg $nick You must specify a channel. Syntax: /msg $me delete #channel nick }
- elseif (!$3) { .msg $nick You must specify a nick. Syntax: /msg $me delete #channel nick }
- else { .msg $nick $sb.delserver($2,$3) }
- }
- ;*** Adds an index channel
- elseif ($1 == addchan) {
- if (!$2) { .msg $nick You must specify a channel. Useage: /msg $me addchan #channel }
- else { .msg $nick $sb.addchan($2) }
- }
- ;*** Deletes an index channel
- elseif ($1 == delchan) {
- if (!$2) { .msg $nick You must specify a channel. Useage: /msg $me delchan #channel }
- else { .msg $nick $sb.delchan($2,$nick) }
- }
- ;*** Deletes a new release manually.
- elseif ($1 == delrelease) {
- if (!$2) || (!$3) { .msg $nick Error: You must specify a channel and a release name. Useage: /msg $me delrelease #channel releasetext }
- else { .msg $nick $sb.delrelease($2,$3-) }
- }
- ;*** Lists all releases for a channel.
- elseif ($1 == listreleases) {
- if (!$2) { .msg $nick Error: You must specify a channel. Useage: /msg $me listreleases #channel }
- else { sb.listreleases $2 $nick }
- }
- ;*** Sets an advertisement
- elseif ($1 == setadvert) {
- if (!$2) || (!$3) { .msg $nick Error. You must specify a channel or defualt and advertisement. Useage: /msg $me setadvert #channel/default new advertisement. }
- else { .msg $nick $sb.setadvert($2,$3-) }
- }
- ;*** Deletes an advertisement
- elseif ($1 == deladvert) {
- if (!$2) { .msg $nick Error. You must specify a channel or default. Useage: /msg $me deladvert #channel }
- else { .msg $nick $sb.deladvert($2) }
- }
- ;*** Get the advertisement for a channel without substitutions. [triggers] is replaced with the current triggers [indexchans] is replaced with the indexed channels.
- elseif ($1 == getadvert) {
- if (!$2) { .msg $nick You must specify a channel. }
- else { .msg $nick $sb.getadvert($2) }
- }
- ;*** Sets the repeat time for an ad.
- elseif ($1 == setadtime) {
- if (!$2) || (!$3) { .msg $nick Error. You must specify a channel and advertisement time. Useage: /msg $me setadvert #channel 300. }
- else { .msg $nick $sb.setadtime($2,$3) }
- }
- }
- ;*** Operator Commands - Checks if you are an owner, admin, or op. Limits Commands nested in this if to an owner, admin, or op.
- if ( $hget(SearchBOT.sessions,$nick) == op ) || ( $hget(SearchBOT.sessions,$nick) == admin ) || ( $hget(SearchBOT.sessions,$nick) == owner ) {
- ;*** Searches for a nick in a channels index. Returns information about the nick.
- if ($1 == info) {
- if ($left($2,1) != $chr(35)) { .msg $nick You must specify a channel. Syntax: /msg $me info #channel nick }
- elseif (!$3) { .msg $nick You must specify a nick. Syntax: /msg $me info #channel nick }
- else { .msg $nick $sb.findserver($2,$3) }
- }
- ;*** Lists the channels being indexed.
- elseif ($1 == listchans) { .msg $nick $iif($replace($hget(SearchBOT.settings,indexchan),$chr(44),$chr(32)) != $null,$v1,No channles added yet) }
- ;*** Adds a search trigger to be used to search all packs.
- elseif ($1 == addtrig) {
- if (!$2) { .msg $nick You must specify a trigger. Useage: /msg $me addtrig trigger }
- elseif ($sb.iscommand($2)) { .msg $nick Error: $+(",$2,") is in use by the bot as a command. }
- else { .msg $nick $sb.addtrig($2) }
- }
- ;*** Deletes a search trigger to be used to search all packs.
- elseif ($1 == deltrig) {
- if (!$2) { .msg $nick You must specify a trigger. Useage: /msg $me deltrig trigger }
- else { .msg $nick $sb.deltrig($2) }
- }
- ;*** Adds a new release for a channel.
- elseif ($1 == addrelease) {
- if (!$2) || (!$3) { .msg $nick You must specify a channel and a release. Useage: /msg $me addrelease #channel release }
- else { .msg $nick $sb.addrelease($2,$3-) }
- }
- ;*** See the advert as it would be sent to the channel.
- elseif ($1 == seeadvert) {
- if (!$2) { .msg $nick You must specify a channel. }
- else { .msg $nick $sb.formatadvert($2) }
- }
- ;*** See the set time for an advert to repeat
- elseif ($1 == getadtime) {
- if (!$2) { .msg $nick You must specify a channel. }
- else { .msg $nick $sb.getadtime($2) }
- }
- ;*** Count packs
- elseif ($1 == countpacks) {
- if (!$2) { .msg $nick $sb.countpacks }
- elseif ($2) { .msg $nick $sb.countpacks($2) }
- }
- ;*** Deletes a request.
- elseif ($1 == delrequest) {
- if (!$2) { .msg $nick You must include the text of the request. }
- else { .msg $nick $sb.delrequest($2-) }
- }
- ;*** Deletes An Ignore
- elseif ($1 == delignore) {
- if (!$2) { .msg $nick You must include a nick to unignore. }
- else { .msg $nick $sb.delignore($2) }
- }
- ;*** List the ignore list
- elseif ($1 == listignores) { sb.listignored $nick }
- ;*** List total searches
- elseif ($1 == totalsearches) { sb.searchcount $nick }
- }
- }
- }
- on *:TEXT:*:#: {
- ;*** Checks if the channel is being indexed.
- if ( $istok($hget(SearchBOT.settings,indexchan),$chan,44) ) { tokenize 32 $strip($1-)
- ;*** Checks if the line is an actual XDCC ad (And that it is from a voice or higher)
- if ($chr(35) isin $strip($1-)) && (to request !isin $1-) && (xdcc send !isin $1-) && ($nick($chan,$nick,vho~&)) && ($remove($strip($1),$chr(35),$chr(60),$chr(62),$chr(171),$chr(187)) isnum) {
- ;*** #Number ****************************************************************************************************************************************
- set -u1 %Pack.# $strip($remove($wildtok($1-,*#*,1,32),$chr(91),$chr(93),$chr(171),$chr(187)))
- ;*** GETs *******************************************************************************************************************************************
- set -u1 %Pack.GETs $remove($iif(x isin $2,$2,$iif(x isin $3,$3,$4)),x)
- ;*** SiZE *******************************************************************************************************************************************
- set -u1 %Pack.SiZE $remove($iif($chr(93) isin $3,$3,$iif($chr(93) isin $4,$4,$5)),$chr(91),$chr(93))
- ;*** Title / Name ***********************************************************************************************************************************
- set -u1 %Pack.RLS $replace($iif($chr(93) isin $3,$4-,$iif($chr(93) isin $4,$5-,$6-)),$chr(32),$chr(42))
- ;****************************************************************************************************************************************************
- if (MB isin %Pack.SiZE) || ($right(%Pack.SiZE,1) == M) { set -u1 %Pack.SiZE $+($remove(%Pack.SiZE,M,B),14MB) }
- elseif (GB isin %Pack.SiZE) || ($right(%Pack.SiZE,1) == G) { set -u1 %Pack.SiZE $+($remove(%Pack.SiZE,G,B),14GB) }
- elseif (TB isin %Pack.SiZE) || ($right(%Pack.SiZE,1) == T) { set -u1 %Pack.SiZE $+($remove(%Pack.SiZE,M,B),14TB) }
- ;****************************************************************************************************************************************************
- ;echo 4 -st %Pack.# %Pack.GETs %Pack.SiZE %Pack.RLS
- ;****************************************************************************************************************************************************
- ;*** Checks if the pack is #1 (And if the channel's index is made) - Deletes all packs from a user when they list #1 to ensure old packs arent updated if they list fewer than before.
- if ($+($chr(35),1,$chr(32)) isin $strip($1-)) && ($hget($+(SearchBOT.,$chan))) { hdel -w $+(SearchBOT.,$chan) $+($nick,.*) }
- ;*** Checks to see if the channel's index is made
- elseif (!$hget($+(SearchBOT.,$chan))) { halt }
- ;*** Adds all packs after #1 for a user.
- sb.addpack $chan $nick %Pack.# $1-
- ;****************************************************************************************************************************************************
- hadd -m $+(Packs.,$nick) %Pack.# %Pack.# %Pack.RLS %Pack.SiZE %Pack.GETs $ctime $network $chan $+($server,:,$port)
- ;****************************************************************************************************************************************************
- ;*** New Release
- $iif($hget(Packs,$+($nick,$chr(255),%Pack.#)) != %Pack.RLS,set -u1 %Pack.NEW RLS) | $iif(!$hget(Packs,$+($nick,$chr(255),%Pack.#)),unset %Pack.NEW)
- ;****************************************************************************************************************************************************
- hadd -mu19000 Packs $+($nick,$chr(255),%Pack.#) %RLS
- hadd -mu19000 Gets $+($nick,$chr(255),%Pack.#) $+(%Pack.GETs,$chr(255),%Pack.RLS)
- hadd -mu19000 Files %Pack.RLS $+($nick,$chr(255),%Pack.#)
- $iif(!$hget(Chan,$chan),hadd -mu19000 Chan $chan)
- ;****************************************************************************************************************************************************
- ;if ($readini(Files.ini,Files,%RLS) != 1) { writeini -n $+(Latest.ini) Files %RLS 1 | write $+(Latest.txt) $ctime $chan %RLS }
- unset %Pack.*
- }
- }
- }
- ;################
- ;# Play event
- ;################
- on *:playend: { if ($filename != $scriptdirSearchBOT.mrc) { if (!$sb.playcheck($filename)) { .remove $+(",$filename,") } } }
- ;###############
- ;# Help Sections
- ;###############
- [allusers]
- You can send any of these commands to Me in Private Message (4NOTE: All Users can access these commands without logging in) 4->
- 3Online *search*string* - To search online online packs
- 3Offline *search*string* - To search online offline packs
- 3Triggers - To get a list of triggers (These search both online and offline packs)
- 3Login Password - To login and 3Logout - To logout (4NOTE: Passwords are case sensitive)
- [owner]
- Owner Section - Only Owners can access this section
- 3Changepass level newpass - Levels are Owner Admin and Op (4NOTE: Passwords are case sensitive)
- 3Getpass Level - Levels are Owner Admin and Op (4NOTE: Passwords are case sensitive)
- 3Sessions - Lists all currently logged in hosts.
- 3Dissconnect Host - Disconnects a user that is logged in. (4NOTE: You can copy/paste the host from the 3Sessions Listing)
- [admin]
- Asmin Section - Only Admins and Owners can access this section
- 3Delnick #Channel Nick - Deletes all packs listed by a nick on the specified Channel
- 3Addchan #Channel - Adds a channel to be indexed.
- 3Delchan #Channel - Deletes a channel from being indexed.
- 3ListReleases #Channel - Lists all releases for the specified channel
- 3DelRelease #Channel Release text - Deletes a release from a channel's list manually. Copy and paste the text from the release listing.
- 3SetAdvert #Channel Advertisement text - Sets a channel's custom advertisement. You may also set a defualt ad for a channels that do not use a custom advert but enable a running advert with Setadtime. [triggers] will substitute to "!find !XS" etc. [indexchans] will substitute to "#indexchannel1,#indexchannel2" etc.
- 3GetAdvert #Channel - Returns the advert text for a channel (or default) without substitutions.
- 3DelAdvert #Channel - Will delete a channel's advert. You can also specify default.
- 3SetAdTime #Channel 300 - Sets a repeat time for a channels advertisment (4NOTE: Time is in seconds) You MUST issue this command after setting either a default ad, or a custom ad (4NOTE: Your ad will not run without this setting)
- [op]
- Operator Section - Only Ops and Above can access this section.
- 3Info #Channel Nick - Tells you how many packs a nick has listed on the channel.
- 3ListChans - Lists the channels the bot is indexing.
- 3AddTrig Trigger - Adds a new trigger to search all packets.
- 3DelTrig Trigger - Deletes an existing trigger that searches all packets.
- 3AddRelease #Channel Release Text - Adds a New Release for a channel. Will be automatically deleted. Delete date will be specified after using the command.
- 3SeeAdvert #Channel - Shows you the advertisement for a channel (may use Default instead of a channel to see the defualt ad).
- 3GetAdTime #Channel - Shows you the repeat time for a channel's ad.
- 3Countpacks - Shows you the number of packs indexed on all channels where 3Countpacks #Channel - Will show the number of packs on that channel
- 4------- IMPORTANT 15- 14Do not add any triggers that match any given command. This will cause conflicts. I will address this issue later. 4---------
Advertisement
Add Comment
Please, Sign In to add comment