Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc pub:remove {nick uhost handle channel arg} {
- if {
- ![info exists db(eplay_db)]
- || ([info exists db(eplay_db)]
- && [mysqlstate $db(eplay_db)] == "7"
- || [info exists db(eplay_db)]
- && [mysqlstate $db(eplay_db)] == "UNCONNECTED")
- } {
- set db(eplay_db) [mysqlconnect -host $eplay_db(localhosst) -user $eplay_db(eplay) -password $eplay_db(...) -db $eplay_db(eplay)]
- }
- global eplay_db
- set arg [split [join $arg]]
- if {[isop $nick $channel]} {
- set link [lindex $arg 0]
- if {$link != {}} {
- set link [::mysql::escape $eplay_db $link]
- set r1 [::mysql::sel $eplay_db "SELECT 1 FROM works WHERE link = '$link'"]
- if {$r1 > 0} {
- set r2 [::mysql::exec $eplay_db "DELETE FROM works WHERE link = '$link'"]
- if {$r2 == 1} {
- putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Work removido com sucesso \002\0039,1»\00314]"
- } else {
- 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]"
- }
- } else {
- putserv "PRIVMSG $channel :$nick: Esse work não existe"
- }
- } else {
- putserv "PRIVMSG $channel :\002\00314,1\[\0039«\002\0030 Sintaxe: !remove <link> \002\0039,1»\00314]"
- }
- }
- }
- bind pub - !remove pub:remove
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement