lib

package
v0.0.0-...-9e54898 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cache *redis.Client

Cache is the main Redis cache of the app

View Source
var Colors = []color.NRGBA{
	{0xcd, 0xdc, 0x39, 0xff},
	{0x03, 0xa9, 0xf4, 0xff},
	{0xf4, 0x43, 0x36, 0xff},
	{0x8b, 0xc3, 0x4a, 0xff},
	{0x00, 0xbc, 0xd4, 0xff},
	{0xff, 0x98, 0x00, 0xff},
	{0x9c, 0x27, 0xb0, 0xff},
	{0x00, 0x96, 0x88, 0xff},
	{0xe9, 0x1e, 0x63, 0xff},
	{0x79, 0x55, 0x48, 0xff},
	{0x4c, 0xaf, 0x50, 0xff},
	{0xff, 0xc1, 0x07, 0xff},
	{0x3f, 0x51, 0xb5, 0xff},
	{0x21, 0x96, 0xf3, 0xff},
	{0xff, 0xeb, 0x3b, 0xff},
}

Colors defines the colors available for charts

Green is a tool to display Green color into the term

Red is a tool to display Red color into the term

Functions

func DoRequest

func DoRequest(request *http.Request) (*http.Response, error)

DoRequest makes an HTTP request with the default client

func EncodeURL

func EncodeURL(input string, params map[string]string) string

EncodeURL parses an URL with its query parameters

func Error

func Error(bot *telegram.BotAPI, update *telegram.Update, message string) error

Error sends a formatted error message in the Telegram chat

func LoadEnv

func LoadEnv(path string)

LoadEnv loads all the environment variables stored in a .env file

func OpenCache

func OpenCache()

OpenCache creates the Redis client and connects to the cache

func ParseTelegramMessage

func ParseTelegramMessage(input string) (output string)

ParseTelegramMessage escapes all the characters required to print MarkdownV2 content

func Plot

func Plot(c chart.Chart, name string) telegram.FileReader

Plot generates the image file for a chart, ready to be sent over Telegram

Types

type Command

type Command struct {
	// Name of the command as shown in Telegram UI
	Name string
	// A complete description of the command to show in the help message
	Description string
	// The list of flags that can be passed by the user
	Flags map[string]Flag
	// The command actions
	Execute func(bot *telegram.BotAPI, update *telegram.Update, args []string, flags map[string]interface{}) error
}

Command describes a Telegram commands with all its information

func (Command) Help

func (c Command) Help() (content string)

type Flag

type Flag struct {
	// A complete description of the flag to show in the help message
	Description string
	// Default value of the flag. Currently supported types: string, integer, float
	Value interface{}
}

Flag holds the data of a command flag, that's to say an optional parameter passed at the beginning

Jump to

Keyboard shortcuts

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