Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 0.88 KB | None | 0 0
  1.  
  2. proc public_youtube {nick userhost handle channel args} {
  3.     global youtube botnick
  4.     if {[regexp -nocase -- $youtube(pattern) $args match fluff video_id]} {
  5.         note "Fetching title for $match."
  6.         if {[catch {set title [fetch_title $match]} error]} {
  7.             note "Failed to fetch title: $error"
  8.         } else {
  9.             set tinyurl $match
  10.             if { $youtube(tiny_url) == 1 && \
  11.               [catch {set tinyurl [make_tinyurl $match]}]} {
  12.                note "Failed to make tiny url for $match."
  13.             }
  14.             set tokens [list %botnick% $botnick %post_nickname% \
  15.                 $nick %title% "$title" %youtube_url% \
  16.                 "$match" %tinyurl% "$tinyurl"]
  17.             set result [string map $tokens $youtube(response_format)]
  18.             putserv "PRIVMSG $channel :'\[\002You\0030,4tube\003\002\]' $result"
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement