Ping TCL
Started 3 months ago by Craig Martin in TCL Requests
BLaCkShaDoW replied 1 month ago
Good day! Can I request a new update !ping TCL. This is only !ping tcl alone. Seems like BlackTrivia only have this. If it is possible...
Body
Good day!
Can I request a new update !ping TCL. This is only !ping tcl alone. Seems like BlackTrivia only have this. If it is possible Sir Daniel in your vacant time.
Thank you!
Tags: #BlackPing
1 Replies
-
Replied 1 month ago
bind pub - "!ping" pub_ping bind ctcr - "PING" ctcp_ping_response ### proc pub_ping {nick uhost hand chan text} { set current_time [clock milliseconds] set latency_key "latency_$nick" set ::latency_map($latency_key) $current_time set ::latency_map($latency_key:chan) $chan putserv "PRIVMSG $nick :\001PING $current_time\001" } ### proc ctcp_ping_response {nick uhost hand dest key text} { set start_time $text if {[info exists ::latency_map(latency_$nick)]} { unset ::latency_map(latency_$nick) set latency [expr {abs([expr [expr {abs([clock milliseconds])} - $start_time] / 1000.000])}] set progress_bar [create_progress_bar $latency] set colorful_message "\00304$nick\003: Pong! \00309Latency:\003 $latency ms $progress_bar" putserv "PRIVMSG $::latency_map(latency_$nick:chan) :$colorful_message" unset ::latency_map(latency_$nick:chan) } } ### proc create_progress_bar {latency} { set max_latency 10 set bar_length 20 set fill_length [expr {int(($latency / double($max_latency)) * $bar_length)}] if {$fill_length > $bar_length} { set fill_length $bar_length } set bar_filled [string repeat "█" $fill_length] set bar_empty [string repeat "░" [expr {$bar_length - $fill_length}]] return "\00303\[$bar_filled\00314$bar_empty\00303\]" }
Bottom ad position