bot

package
v0.0.0-...-795570d Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuyAction

func BuyAction(db *db.Database) (BuyInstruction, Buy)

func NewBot

func NewBot(configuration *configuration.Configuration) *tgbotapi.BotAPI

func NewMessagesBuffer

func NewMessagesBuffer() map[int]string

func SellAction

func SellAction(db *db.Database) (SellInstruction, Sell)

func User

func User(update *tgbotapi.Update) *domain.User

Types

type Action

type Action interface {
	// contains filtered or unexported methods
}

func NewActions

func NewActions(db *db.Database) []Action

NewActions TODO: tbd by config

type App

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

func NewApp

func NewApp() (*App, error)

func (App) Close

func (a App) Close()

func (App) Process

func (a App) Process(updates tgbotapi.UpdatesChannel)

func (App) Reply

func (a App) Reply(update *tgbotapi.Update) (string, interface{})

Reply TODO: improve (reduce) amount ifs conditions. Make it generic Reply: TODO: support one shot command values

func (App) Send

func (a App) Send(message string)

func (App) Start

func (a App) Start() error

type Buy

type Buy struct {
	Command      string
	Regex        *regexp.Regexp
	Db           *db.Database
	Users        *db.Collection
	Assets       *db.Collection
	Transactions *db.Collection
}

type BuyInstruction

type BuyInstruction struct {
	Command string
}

type Sell

type Sell struct {
	Command      string
	Regex        *regexp.Regexp
	Db           *db.Database
	Users        *db.Collection
	Assets       *db.Collection
	Transactions *db.Collection
}

type SellInstruction

type SellInstruction struct {
	Command string
}

type Start

type Start struct {
	Command string
	Users   *db.Collection
}

func StartAction

func StartAction(users *db.Collection) Start

type Trade

type Trade struct {
	Total         float64
	Transaction   domain.Transaction
	WalletAssets  []domain.WalletAssetDocument
	AtomicHandler func(context mongo.SessionContext) (interface{}, error)
}

type Wallet

type Wallet struct {
	Command string
	Users   *db.Collection
}

func WalletAction

func WalletAction(users *db.Collection) Wallet

Jump to

Keyboard shortcuts

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