Advertisement
Guest User

Untitled

a guest
May 26th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.00 KB | None | 0 0
  1. proc isFix {nick uhost handle channel arg} {
  2. variable conn
  3. variable table
  4.  
  5. if {![channel get [string tolower $channel] prebot-fix]} {return 0}
  6.  
  7. set type [string tolower [lindex $arg 1]]
  8. set rls [lindex $arg 2]
  9. set rsn [lindex $arg 3]
  10.  
  11. if {$type==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing type\00307\002\]\002\003"; return 0
  12. } elseif {$rls==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing release\00307\002\]\002\003"; return 0
  13. } 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 }
  14.  
  15. set query [::mysql::sel $conn "SELECT `date`,`status`,`sec`,`grp`,`count`,`size`,`gn` FROM `$table(db)` WHERE `rls`='[mysqlescape $rls]'" -flatlist]
  16. if {$query == ""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: Release not in dB\00307\002\]\002\003"; return 0 }
  17.  
  18. foreach {olddate oldstatus oldsec oldgrp oldfc oldfs oldgn} $query {
  19.  
  20. if {$type=="date" || $type=="time" || $type=="unixtime"} {
  21. if {$rsn==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing $type\00307\002\]\002\003"; return 0
  22. } 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 }
  23.  
  24. ::mysql::exec $conn "UPDATE `$table(db)` SET `date`='$rsn' WHERE `rls`='[mysqlescape $rls]'"
  25. 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"
  26. }
  27.  
  28. ## Mybe add a delete part here date
  29.  
  30.  
  31.  
  32. ## Mybe add a delete part here info
  33.  
  34. if {$type=="genre" || $type=="genres" || $type=="gn"} {
  35. if {$rsn==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing $type\00307\002\]\002\003"; return 0 }
  36.  
  37. 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 }
  38.  
  39. if {$oldgn=="$rsn"} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: duplicate $type\00307\002\]\002\003"; return 0 }
  40. ::mysql::exec $conn "UPDATE `$table(db)` SET `gn`='[mysqlescape $rsn]' WHERE `rls`='[mysqlescape $rls]'"
  41. 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"
  42. }
  43.  
  44. ## Mybe add a delete part here genre
  45.  
  46. if {$type=="group" || $type=="grp"} {
  47. if {$rsn==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing $type\00307\002\]\002\003"; return 0 }
  48.  
  49. if {$oldgrp=="$rsn"} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: duplicate $type\00307\002\]\002\003"; return 0 }
  50. ::mysql::exec $conn "UPDATE `$table(db)` SET `grp`='[mysqlescape $rsn]' WHERE `rls`='$rls'"
  51. 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"
  52. }
  53.  
  54. ## Mybe add a delete part here group
  55.  
  56. if {$type=="sec" || $type=="section"} {
  57. if {$rsn==""} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: missing $type\00307\002\]\002\003"; return 0 }
  58.  
  59. if {$oldsec=="$rsn"} {prenow "PRIVMSG $channel :\00307\002\[\002\00304Fix-Error\00307\002\] \[\002\00303Reason: duplicate $type\00307\002\]\002\003"; return 0 }
  60. 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 }
  61. ::mysql::exec $conn "UPDATE `$table(db)` SET `sec`='[isSec $rsn]' WHERE `rls`='[mysqlescape $rls]'"
  62. 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"
  63. }
  64.  
  65. ## Mybe add a delete part here sec
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement