Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. proc pub:remove {nick uhost handle channel arg} {
  2. if {
  3. ![info exists db(eplay_db)]
  4. || ([info exists db(eplay_db)]
  5. && [mysqlstate $db(eplay_db)] == "7"
  6. || [info exists db(eplay_db)]
  7. && [mysqlstate $db(eplay_db)] == "UNCONNECTED")
  8. } {
  9. set db(eplay_db) [mysqlconnect -host $eplay_db(localhosst) -user $eplay_db(eplay) -password $eplay_db(...) -db $eplay_db(eplay)]
  10. }
  11. global eplay_db
  12. set arg [split [join $arg]]
  13. if {[isop $nick $channel]} {
  14. set link [lindex $arg 0]
  15. if {$link != {}} {
  16. set link [::mysql::escape $eplay_db $link]
  17. set r1 [::mysql::sel $eplay_db "SELECT 1 FROM works WHERE link = '$link'"]
  18. if {$r1 > 0} {
  19. set r2 [::mysql::exec $eplay_db "DELETE FROM works WHERE link = '$link'"]
  20. if {$r2 == 1} {
  21. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Work removido com sucesso \002\0039,1»\00314]"
  22. } else {
  23. 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]"
  24. }
  25. } else {
  26. putserv "PRIVMSG $channel :$nick: Esse work não existe"
  27. }
  28. } else {
  29. putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Sintaxe: !remove <link> \002\0039,1»\00314]"
  30. }
  31. }
  32. }
  33. bind pub - !remove pub:remove
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement