Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. proc pub:commands {nick uhost handle channel arg} {
  2. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 !request !works !channels !addwork !remove \002\0039,1»\00314]"
  3. }
  4. bind pub - !commands pub:commands
  5.  
  6. proc pub:request {nick uhost handle channel arg} {
  7. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Regras para fazer um Request \002\0039,1»\00314]"
  8. }
  9. bind pub - !request pub:request
  10.  
  11. proc pub:works {nick uhost handle channel arg} {
  12. global eplay_db
  13. if {[::mysql::sel $eplay_db {SELECT * FROM works}] > 0} {
  14. ::mysql::map $eplay_db {auth status link} {
  15. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 By $auth - (\0034$status\0030) - $link \002\0039,1»\00314]"
  16. }
  17. } else {
  18. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Não há works disponíveis neste momento. \002\0039,1»\00314]"
  19. }
  20. }
  21. bind pub - !works pub:works
  22.  
  23. proc pub:channels {nick uhost handle channel arg} {
  24. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Canal Eplay Youtube \002\0039,1»\00314]"
  25. }
  26. bind pub - !channels pub:channels
  27.  
  28. proc pub:addwork {nick uhost handle channel arg} {
  29. global eplay_db
  30. set arg [split [join $arg]]
  31. if {[isop $nick $channel]} {
  32. set auth [lindex $arg 0]
  33. set status [lindex $arg 1]
  34. set link [lindex $arg 2]
  35. if {$auth != {} && $status != {} && $link != {}} {
  36. set auth [::mysql::escape $eplay_db $auth]
  37. set status [::mysql::escape $eplay_db $status]
  38. set link [::mysql::escape $eplay_db $link]
  39. set r1 [::mysql::sel $eplay_db "SELECT 1 FROM works WHERE auth = '$auth'"]
  40. if {$r1 == 0} {
  41. set r2 [::mysql::exec $eplay_db "INSERT INTO works VALUES ('$auth','$status','$link')"]
  42. if {$r2 == 1} {
  43. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Work adicionado com sucesso \002\0039,1»\00314]"
  44. } else {
  45. 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]"
  46. }
  47. } else {
  48. putserv "PRIVMSG $channel :$nick: Esse work já existe"
  49. }
  50. } else {
  51. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Sintaxe: !addwork <auth> <status> <link> \002\0039,1»\00314]"
  52. }
  53. }
  54. }
  55. bind pub - !addwork pub:addwork
  56.  
  57. proc pub:remove {nick uhost handle channel arg} {
  58. global eplay_db
  59. set arg [split [join $arg]]
  60. if {[isop $nick $channel]} {
  61. set link [lindex $arg 0]
  62. if {$auth != {} && $status != {} && $link != {}} {
  63. set link [::mysql::escape $eplay_db $link]
  64. set r1 [::mysql::sel $eplay_db "SELECT 1 FROM works WHERE auth = '$auth'"]
  65. if {$r1 == 0} {
  66. set r2 [::mysql::exec $eplay_db "REMOVE INTO works VALUES ('$auth','$status','$link')"]
  67. if {$r2 == 1} {
  68. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Work adicionado com sucesso \002\0039,1»\00314]"
  69. } else {
  70. 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]"
  71. }
  72. } else {
  73. putserv "PRIVMSG $channel :$nick: Esse work já existe"
  74. }
  75. } else {
  76. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Sintaxe: !addwork <auth> <status> <link> \002\0039,1»\00314]"
  77. }
  78. }
  79. }
  80. bind pub - !remove pub:remove
  81.  
  82. package require mysqltcl
  83.  
  84. set eplay_db [::mysql::connect -host "localhost" -user "eplay" -password "..." -db "eplay"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement