Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.86 KB | None | 0 0
  1. proc gth_closemysql {min hour day month year} {
  2.  
  3. if {$min == "08" || $min == "09" || $min % 5 > 0} { return }
  4. mysqlclose
  5. global eplay_db
  6. set eplay_db [::mysql::connect -host "localhost" -user "eplay" -password "ptz6MBtKnQTUfMJr" -db "eplay"]
  7. putlog "*** A fechar ligacões mysql activas...."
  8. }
  9. bind time - "* * * * *" gth_closemysql
  10.  
  11. proc pub:commands {nick uhost handle channel arg} {
  12. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 !request !works !channels !addwork !remove !edit \002\0039,1»\00314]"
  13. }
  14. bind pub - !commands pub:commands
  15.  
  16. proc pub:request {nick uhost handle channel arg} {
  17. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Regras para fazer um Request \002\0039,1»\00314]"
  18. }
  19. bind pub - !request pub:request
  20.  
  21.  
  22. proc pub:works {nick uhost handle channel arg} {
  23. global eplay_db
  24. if {![info exists eplay_db] || ([info exists eplay_db] && [mysqlstate $eplay_db] == "7" || [info exists eplay_db] && [mysqlstate $eplay_db] == "UNCONNECTED")} {
  25. set eplay_db [::mysql::connect -host "localhost" -user "eplay" -password "ptz6MBtKnQTUfMJr" -db "eplay"]
  26. }
  27. if {[::mysql::sel $eplay_db {SELECT * FROM works}] > 0} {
  28. ::mysql::map $eplay_db {auth status link} {
  29. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 By $auth - (\00304$status\0030) - $link \002\0039,1»\00314]"
  30. }
  31. } else {
  32. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Não há works disponíveis neste momento. \002\0039,1»\00314]"
  33. }
  34. }
  35. bind pub - !works pub:works
  36.  
  37. proc pub:channels {nick uhost handle channel arg} {
  38. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Canal Eplay Youtube \002\0039,1»\00314]"
  39. }
  40. bind pub - !channels pub:channels
  41.  
  42. proc pub:addwork {nick uhost handle channel arg} {
  43. global eplay_db
  44. if {![info exists eplay_db] || ([info exists eplay_db] && [mysqlstate $eplay_db] == "7" || [info exists eplay_db] && [mysqlstate $eplay_db] == "UNCONNECTED")} {
  45. set eplay_db [::mysql::connect -host "localhost" -user "eplay" -password "ptz6MBtKnQTUfMJr" -db "eplay"]
  46. }
  47. set arg [split [join $arg]]
  48. if {[isop $nick $channel]} {
  49. set auth [lindex $arg 0]
  50. set status [lindex $arg 1]
  51. set link [lindex $arg 2]
  52. if {$auth != {} && $status != {} && $link != {}} {
  53. set auth [::mysql::escape $eplay_db $auth]
  54. set status [::mysql::escape $eplay_db $status]
  55. set link [::mysql::escape $eplay_db $link]
  56. set r1 [::mysql::sel $eplay_db "SELECT 1 FROM works WHERE link = '$link'"]
  57. if {$r1 == 0} {
  58. set r2 [::mysql::exec $eplay_db "INSERT INTO works VALUES ('$auth','$status','$link')"]
  59. if {$r2 == 1} {
  60. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Work adicionado com sucesso \002\0039,1»\00314]"
  61. } else {
  62. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Ocorreu um erro ao adicionar o work. Por favor, tenta outra vez. \002\0039,1»\00314]"
  63. }
  64. } else {
  65. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 $nick: Esse work já existe \002\0039,1»\00314]"
  66. }
  67. } else {
  68. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Sintaxe: !addwork <auth> <status> <link> \002\0039,1»\00314]"
  69. }
  70. }
  71. }
  72. bind pub - !addwork pub:addwork
  73.  
  74. proc pub:remove {nick uhost handle channel arg} {
  75. global eplay_db
  76. if {![info exists eplay_db] || ([info exists eplay_db] && [mysqlstate $eplay_db] == "7" || [info exists eplay_db] && [mysqlstate $eplay_db] == "UNCONNECTED")} {
  77. set eplay_db [::mysql::connect -host "localhost" -user "eplay" -password "ptz6MBtKnQTUfMJr" -db "eplay"]
  78. }
  79. set arg [split [join $arg]]
  80. if {[isop $nick $channel]} {
  81. set link [lindex $arg 0]
  82. if {$link != {}} {
  83. set link [::mysql::escape $eplay_db $link]
  84. set r1 [::mysql::sel $eplay_db "SELECT 1 FROM works WHERE link = '$link'"]
  85. if {$r1 > 0} {
  86. set r2 [::mysql::exec $eplay_db "DELETE FROM works WHERE link = '$link'"]
  87. if {$r2 == 1} {
  88. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Work removido com sucesso \002\0039,1»\00314]"
  89. } else {
  90. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Ocorreu um erro ao remover o work. Por favor, tenta outra vez. \002\0039,1»\00314]"
  91. }
  92. } else {
  93. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 $nick: Esse work não existe \002\0039,1»\00314]"
  94. }
  95. } else {
  96. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Sintaxe: !remove <link> \002\0039,1»\00314]"
  97. }
  98. }
  99. }
  100. bind pub - !remove pub:remove
  101.  
  102. proc pub:edit {nick uhost handle channel arg} {
  103. global eplay_db
  104. if {![info exists eplay_db] || ([info exists eplay_db] && [mysqlstate $eplay_db] == "7" || [info exists eplay_db] && [mysqlstate $eplay_db] == "UNCONNECTED")} {
  105. set eplay_db [::mysql::connect -host "localhost" -user "eplay" -password "ptz6MBtKnQTUfMJr" -db "eplay"]
  106. }
  107. set arg [split [join $arg]]
  108. if {[isop $nick $channel]} {
  109. set status [lindex $arg 0]
  110. set link [lindex $arg 1]
  111. if {$status != "" && $link != ""} {
  112. set status [::mysql::escape $eplay_db $status]
  113. set link [::mysql::escape $eplay_db $link]
  114. set r1 [mysql::sel $eplay_db "SELECT * FROM `works` WHERE `link`='${link}'"]
  115. if {$r1 > 0} {
  116. # link exists
  117. set r2 [::mysql::exec $eplay_db "UPDATE works SET status = '$status' WHERE link = '$link'"]
  118. if {$r2 == 1} {
  119. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Work editado com sucesso \002\0039,1»\00314]"
  120. } else {
  121. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Ocorreu um erro ao editar o work. Por favor, tenta outra vez. \002\0039,1»\00314]"
  122. }
  123. } else {
  124. putserv "PRIVMSG $channel :$nick: Esse work não existe"
  125. }
  126. } else {
  127. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Sintaxe: !edit <status> <link> \002\0039,1»\00314]"
  128. }
  129. }
  130. }
  131. bind pub - !edit pub:edit
  132.  
  133.  
  134. package require mysqltcl
  135.  
  136. set eplay_db [::mysql::connect -host "localhost" -user "eplay" -password "ptz6MBtKnQTUfMJr" -db "eplay"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement