View difference between Paste ID: PREJbJpQ and Ku7wKhUY
SHOW: | | - or go back to the newest paste.
1
proc dupe:top {nick uhost handle chan arg} {
2
    global db_handle mysql_ chan_ infotable_ bopen bclose bdiv
3
    
4
    set days [expr 30 - [strftime %u]]
5
	set days2go [expr {$days==1?"1 day":"$days days"}]
6
    set quota_(amount) "20"
7
    set place 0
8
    set refine ""
9-
    if {[llength $arg] >= 1} { set refine "WHERE `user` = '[mysqlescape [string trim [lindex $arg 0]]]'" }
9+
    if {[llength $arg] >= 1} {
10
        set refine "WHERE `user` = '[mysqlescape [string trim [lindex $arg 0]]]'"
11-
    putnow "PRIVMSG $chan_(kadd) :${bopen}\00303KNOWN \00311MP3 \00303RELEASE GROUP\003${bclose} ${bopen}\00303HONOR \00311TV \00303RELEASE GROUP\003${bclose} ${bopen}\00303KNiSO \00311APPS \00303RELEASE GROUP\003${bclose}"
11+
        putnow "PRIVMSG $chan_(kadd) :${bopen}\00303KNOWN \00311MP3 \00303RELEASE GROUP\003${bclose} ${bopen}\00303HONOR \00311TV \00303RELEASE GROUP\003${bclose} ${bopen}\00303KNiSO \00311APPS \00303RELEASE GROUP\003${bclose}"
12-
    putnow "PRIVMSG $chan_(kadd) :This month has $days2go left to go! - Get Uploading if your failing the $quota_(amount) releases per month quota."
12+
        putnow "PRIVMSG $chan_(kadd) :This month has $days2go left to go! - Get Uploading if your failing the $quota_(amount) releases per month quota."
13
    }
14
15
    set monthrls [mysqlsel $db_handle "SELECT `user`,COUNT(`user`) AS count FROM `info` WHERE `timestamp` >= UNIX_TIMESTAMP((LAST_DAY(NOW())+ INTERVAL 1 DAY)-INTERVAL 1 MONTH) AND `timestamp` < UNIX_TIMESTAMP(LAST_DAY(NOW())+ INTERVAL 1 DAY) $refine GROUP BY `user` ORDER BY `count` DESC" -list]
16
17
    if {![mysqlsel $db_handle "SELECT `user`,COUNT(`user`) AS count FROM `info` $refine GROUP BY `user` ORDER BY `count` DESC"]} {
18
		putnow "PRIVMSG $chan_(kadd) :No results found\."
19
		return 0
20
	}
21
	mysqlmap $db_handle {user count} {
22
		set re {(?i)^}
23
		append re $user {\s\d+$}
24
		set res [lsearch -regexp $monthrls $re]
25
		if {$res != ""} { set mnup "[lindex [lindex $monthrls $res] 1]" } else { set mnup "0" }
26
		putnow "PRIVMSG $chan_(kadd) : \[\00314[num [incr place]]\003\] \00314$user\003 has \00314$count\003 releases. - ${bopen}\00314$mnup\003${bclose}"
27
	}
28
}