Version: v0.0.0-...-e3f4556 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2014 License: MIT Imports: 5 Imported by: 0




This section is empty.


This section is empty.


func IsEmbeddable

func IsEmbeddable(url string) bool

Returns true if the URL points to an image or other embeddable object

func IsImage

func IsImage(url string) bool

Returns true if the URL points to an image

func ShortenUrls

func ShortenUrls(text string, shortenEmbeds bool, shortenImages bool, maxLength int) (int, string)

ShortenUrls shortens URLs in the given text. By default, it only shortens URLs if they are longer than the specified maxLength and not embeddable. Supplying a true value to shortenEmbeds or shortenImages will change that behavior. In addition, if shortenImages is true, the shortened URL will have '#.png' appended, in order to enable clients to embed the image. Returns a count of shortened URLs and the (potentially) modified text.


type LinkShortener

type LinkShortener struct {
	Client              *irc.Conn
	AlwaysShortenEmbeds bool
	MaxUrlLength        int

LinkShortener shortens any URLs in messages it hears and echos them back to the source.

func (LinkShortener) Hear

func (l LinkShortener) Hear(target string, line string, from string) (responded bool)

func (LinkShortener) Respond

func (l LinkShortener) Respond(target string, line string, from string) (responded bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL