jimbot

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

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

Go to latest
Published: Jul 14, 2022 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KISS     = "😘"
	HEART    = "💕"
	TONGUE   = "😋"
	UNHAPPY  = "😐"
	SILENT   = "😶"
	HUH      = "🌚"
	HII      = "🙃"
	SWEAT    = "😓"
	SURPRISE = "😮"
)

Emojis

Variables

This section is empty.

Functions

func ChoiceMaker

func ChoiceMaker(choices []string) string

ChoiceMaker : Select a random item from a slice

func DecisionMaker

func DecisionMaker() bool

DecisionMaker : decide if a a reply is needed, randomly

func DownloadFile

func DownloadFile(filepath string, url string) error

DownloadFile : Download a url to a local file. It's efficient because it will write as it downloads and not load the whole file into memory.

func FileToLines

func FileToLines(filePath string) ([]string, error)

FileToLines : Read lines from a text file

func Notifier

func Notifier(reminder Reminder) string

Notifier : wait until it's time to send our reminder

func NowWeather

func NowWeather(city string) string

NowWeather : Current weather info from his/her city

func ProcessCmd

func ProcessCmd(command string, commandArgs string, userID int64) string

ProcessCmd : handles bot commands

func ProcessMsg

func ProcessMsg(message string, userID int64) string

ProcessMsg : handles chat messages

func Search(query string, image bool) string

Search : CSE search, for external use

func StartBot

func StartBot()

StartBot : Connect to Telegram bot API and start working

func ToEnglish

func ToEnglish(text string) string

ToEnglish : translate any language to English

func UpdateConfig

func UpdateConfig(pattern string, withStr string) error

UpdateConfig : Grep a line and replace it with a given string

func WriteStringToFile

func WriteStringToFile(path string, text string, overwrite bool) error

WriteStringToFile : write or append line to file

Types

type CoinPrice

type CoinPrice struct {
	CoinName   string
	PriceInBTC string
	PriceInUSD string
}

CoinPrice : Price info of a coin

func GetPrice

func GetPrice(coin string) CoinPrice

GetPrice : Read coin prices from public API

type Config

type Config struct {
	GFID int64
	BFID int64

	Token           string
	GFName          string
	BFName          string
	CSE             string
	HerCity         string
	HisCity         string
	MemDay          string
	MemdayGreetings string
	Birthday        string
	HuobiAccessKey  string
	HuobiSecretKey  string
}

Config : Read config info from text file

var InitConfig Config

InitConfig : cache config data

func ReadConfig

func ReadConfig() Config

ReadConfig : Read config from config file

type Reminder

type Reminder struct {
	// contains filtered or unexported fields
}

Reminder type for reminders data

func NewReminder

func NewReminder(notifyTime time.Time, event string) Reminder

NewReminder : create new reminder with time and event

type Result

type Result struct {
	Position int64
	Result   *customsearch.Result
}

Result : CSE search result type

Jump to

Keyboard shortcuts

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