Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc isFix {nick uhost handle channel arg} {
- variable conn
- variable table
- if {![channel get [string tolower $channel] prebot-fix]} {return 0}
- set type [string tolower [lindex $arg 1]]
- set rls [lindex $arg 2]
- set rsn [lindex $arg 3]
- if {$type==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing type\00307\002\]\002\003"; return 0
- } elseif {$rls==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing release\00307\002\]\002\003"; return 0
- } elseif {![regexp -nocase {date|time|unixtime|info|genre|genres|gn|group|grp|sec|section} $type]} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: invalid type \00300\002/\002\00303 Type: $type\00307\002\]\002\003"; return 0 }
- set query [::mysql::sel $conn "SELECT `date`,`status`,`sec`,`grp`,`count`,`size`,`gn` FROM `$table(db)` WHERE `rls`='[mysqlescape $rls]'" -flatlist]
- if {$query == ""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: Release not in dB\00307\002\]\002\003"; return 0 }
- foreach {olddate oldstatus oldsec oldgrp oldfc oldfs oldgn} $query {
- if {$type=="date" || $type=="time" || $type=="unixtime"} {
- if {$rsn==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing $type\00307\002\]\002\003"; return 0
- } elseif {[string is integer "$rsn"]=="0"} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: Invalid [string tolower $type] \00300\002/\002\00303 Date: $rsn\00307\002\]\002\003"; return 0 }
- ::mysql::exec $conn "UPDATE `$table(db)` SET `date`='$rsn' WHERE `rls`='[mysqlescape $rls]'"
- prenow "PRIVMSG $channel :\002\00312\[Fix-[string totitle $type]\]\003\003 \00307(\003\002\00303$rls\003\002\00307)\003\003 \00307(\003\002\00303From: [isAge $olddate] ago \00300\002/\002\00303 [clock format $olddate -format {%Y-%m-%d}] \00300\002/\002\00303 [clock format $olddate -format {%H:%M:%S}]\003\002\00307)\003\003 \00307(\003\002\00303To: [isAge $rsn] ago \00300\002/\002\00303 [clock format $rsn -format {%Y-%m-%d}] \00300\002/\002\00303 [clock format $rsn -format {%H:%M:%S}]\003\002\00307)\003\002"
- }
- ## Mybe add a delete part here date
- ## Mybe add a delete part here info
- if {$type=="genre" || $type=="genres" || $type=="gn"} {
- if {$rsn==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing $type\00307\002\]\002\003"; return 0 }
- set gn $rsn; set rsn [isSetGenre $rsn]; if {$rsn=="-"} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303[string totitle $gn] is not a valid genre\00307\002\]\002\003"; return 0 }
- if {$oldgn=="$rsn"} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: duplicate $type\00307\002\]\002\003"; return 0 }
- ::mysql::exec $conn "UPDATE `$table(db)` SET `gn`='[mysqlescape $rsn]' WHERE `rls`='[mysqlescape $rls]'"
- prenow "PRIVMSG $channel :\002\00312\[Fix-[string totitle $type]\]\003\003 \00307(\003\002\00303$rls\003\002\00307)\003\003 \00307(\003\002\00303From: $oldgn\003\002\00307)\003\003 \00307(\003\002\00303To: $rsn\003\002\00307)\003\002"
- }
- ## Mybe add a delete part here genre
- if {$type=="group" || $type=="grp"} {
- if {$rsn==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing $type\00307\002\]\002\003"; return 0 }
- if {$oldgrp=="$rsn"} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: duplicate $type\00307\002\]\002\003"; return 0 }
- ::mysql::exec $conn "UPDATE `$table(db)` SET `grp`='[mysqlescape $rsn]' WHERE `rls`='$rls'"
- prenow "PRIVMSG $channel :\002\00312\[Fix-[string totitle $type]\]\003\003 \00307(\003\002\00303$rls\003\002\00307)\003\003 \00307(\003\002\00303$oldgrp \00300\002->\002\00303 $rsn\003\002\00307)\003\002"
- }
- ## Mybe add a delete part here group
- if {$type=="sec" || $type=="section"} {
- if {$rsn==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing $type\00307\002\]\002\003"; return 0 }
- if {$oldsec=="$rsn"} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: duplicate $type\00307\002\]\002\003"; return 0 }
- if {[isSec $rsn]=="Unknown"} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303[string totitle $rsn] is not a valid section\00307\002\]\002\003"; return 0 }
- ::mysql::exec $conn "UPDATE `$table(db)` SET `sec`='[isSec $rsn]' WHERE `rls`='[mysqlescape $rls]'"
- prenow "PRIVMSG $channel :\002\00312\[Fix-[string totitle $type]\]\003\003 \00307(\003\002\00303$rls\003\002\00307)\003\003 \00307(\003\002\00303[isSecColor [isSec $oldsec]] \00300\002->\002\00303 [isSecColor [isSec $rsn]]\003\002\00307)\003\002"
- }
- ## Mybe add a delete part here sec
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement