util

package
v0.0.0-...-105f304 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2016 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Markdown contains the SendOptions for markdown messages

Functions

func CheckArgs

func CheckArgs(arg string, options ...string) bool

CheckArgs checks if the given list of strings contains the given argument.

func CustomKeyboard

func CustomKeyboard(keyboard [][]string, markdown bool) *telebot.SendOptions

CustomKeyboard creates a SendOptions instance with the given custom keyboard.

func DateToString

func DateToString(date Date) string

DateToString converts a date to a string

func FindSpan

func FindSpan(typ string, key string, val string, node *html.Node) *html.Node

FindSpan finds a html element of the given type with the given key-value attribute from the given node

func HTTPGet

func HTTPGet(url string) string

HTTPGet performs a HTTP GET request on the given URL

func HTTPGetAndParse

func HTTPGetAndParse(url string) (*html.Node, error)

HTTPGetAndParse performs a HTTP GET request on the given URL, parses the output and returns a html.Node pointer

func HTTPGetMin

func HTTPGetMin(url string) string

HTTPGetMin performs a HTTP GET request on the given URL and minifies the output

func HTTPGetMinAndParse

func HTTPGetMinAndParse(url string) (*html.Node, error)

HTTPGetMinAndParse performs a HTTP GET request on the given URL, minifies and parses the output and returns a html.Node pointer

func HTTPGetMinStream

func HTTPGetMinStream(url string) (io.Reader, error)

HTTPGetMinStream performs a HTTP GET request on the given URL, minifies the output and returns a io.Reader pointer

func HTTPGetStream

func HTTPGetStream(url string) (io.Reader, error)

HTTPGetStream performs a HTTP GET request on the given URL and returns a io.Reader pointer

func Render

func Render(node *html.Node) string

Render renders the given HTML node to a string.

func TimeToString

func TimeToString(time Time) string

TimeToString converts a time to a string

func Timestamp

func Timestamp() int64

Timestamp gets the current UNIX timestamp

func TimestampMS

func TimestampMS() int64

TimestampMS gets the current UNIX timestamp in milliseconds

Types

type Date

type Date struct {
	Year  int
	Month int
	Day   int
}

Date contains the year, month and day

func StringToDate

func StringToDate(str string) (Date, error)

StringToDate converts a string to a date

type Time

type Time struct {
	Hours   int
	Minutes int
}

Time contains the hour and minutes

func StringToTime

func StringToTime(str string) (Time, error)

StringToTime converts a string to a time

Jump to

Keyboard shortcuts

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