Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc public_youtube {nick userhost handle channel args} {
- global youtube botnick
- if {[regexp -nocase -- $youtube(pattern) $args match fluff video_id]} {
- note "Fetching title for $match."
- if {[catch {set title [fetch_title $match]} error]} {
- note "Failed to fetch title: $error"
- } else {
- set tinyurl $match
- if { $youtube(tiny_url) == 1 && \
- [catch {set tinyurl [make_tinyurl $match]}]} {
- note "Failed to make tiny url for $match."
- }
- set tokens [list %botnick% $botnick %post_nickname% \
- $nick %title% "$title" %youtube_url% \
- "$match" %tinyurl% "$tinyurl"]
- set result [string map $tokens $youtube(response_format)]
- putserv "PRIVMSG $channel :'\[\002You\0030,4tube\003\002\]' $result"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement