BlackWords.tcl

Started 2 months ago by aslpls in TCL Support

Hello BlackShadow, BlackWords.tcl is working perfect..  Can you please create a small script to autoshow in the channel every 60 minutes...

Body

Hello BlackShadow,

BlackWords.tcl is working perfect..ย 

Can you please create a small script to autoshow in the channel every 60 minutes the top 10 words users?

ย 

Thank you in advance.

ย 

4 Replies

  • Replied 2 weeks ago

    Report

    Thanks @Blakcshadow.. i will test it

  • Replied 1 month ago

    Report

    Add this code to the tcl

    ###
    # Autoshow top users 
    #
    ###
    
    # What type of top to show ? [0 - top total, 1 - top month]
    set words(autoshow:type) "0"
    
    # After how many time to show it ? (minutes)
    set words(autoshow:time) "60"
    
    setudef flag words_autoshow
    
    if {![info exists words(autoshow:start)]} {
    	timer $words(autoshow:time) words:autoshow_start
    	set words(autoshow:start) 1
    }
    
    ###
    proc words:autoshow_start {} {
    	global words
    	set channels ""
    	foreach chan [channels] {
    		if {[channel get $chan words_autoshow]} {
    			lappend channels $chan
    		}
    	}
    	if {$channels != ""} {
    		words:autoshow_start_show 0 $channels
    	}
    }
    
    ###
    proc words:autoshow_start_show {num channels} {
    	global words
    	set chan [lindex $channels $num]
    	switch $words(autoshow:type) {
    		0 {
    			set data [words:top_total $chan]
    			set type 0
    		}
    		1 {
    			set type -1
    			set month_num [clock format [unixtime] -format %m]
    			set data [words:top_month $month_num $chan]
    		}
    		default {
    			set data [words:top_total $chan]
    			set type 0
    		}
    	}
    	if {$data eq -1 || $data -eq 0} {
    		set counter [expr $num + 1]
    		if {[lindex $channels $counter] != ""} {
    			utimer 5 [list words:autoshow_start_show $counter $channels]
    		} else {
    			timer $words(autoshow:time) words:autoshow_start
    		}
    	} else {
    		if {$type eq 0} {
    			putserv "PRIVMSG $chan :Top Words for #bt (TOTAL):"
    		} else {
    			putserv "PRIVMSG $chan :Top Words for #bt (Month):"
    		}
    		putserv "PRIVMSG $chan :$data"
    	}
    	set counter [expr $num + 1]
    	if {[lindex $channels $counter] != ""} {
    		utimer 5 [list words:autoshow_start_show $counter $channels]
    	} else {
    		timer $words(autoshow:time) words:autoshow_start
    	}
    }
  • Replied 1 month ago

    Report

    yes, i will modify it and send it to you.

  • Replied 1 month ago

    Report

    Hey @BlackShadow, is there any chance you can add an autoshow script from this tcl? ๐Ÿ˜

GU
Bottom ad position