bot

package
v0.0.0-...-8d962dd Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BaseMenu = &tele.ReplyMarkup{
		ResizeKeyboard: true,
		ReplyKeyboard: [][]tele.ReplyButton{
			{
				tele.ReplyButton{Text: "✨ Create ✨"},
			},
		},
	}

	FilterMenu = &tele.ReplyMarkup{
		ResizeKeyboard: true,
		ReplyKeyboard: [][]tele.ReplyButton{
			{
				tele.ReplyButton{Text: FilterType.None},
				tele.ReplyButton{Text: FilterType.Red},
				tele.ReplyButton{Text: FilterType.Grey},
				tele.ReplyButton{Text: FilterType.Purple},
				tele.ReplyButton{Text: FilterType.DarkBlue},
			},
			{
				tele.ReplyButton{Text: FilterType.Yellow},
				tele.ReplyButton{Text: FilterType.Orange},
				tele.ReplyButton{Text: FilterType.Green},
				tele.ReplyButton{Text: FilterType.White},
				tele.ReplyButton{Text: FilterType.Black},
			},
		},
	}

	EmptyMenu = &tele.ReplyMarkup{RemoveKeyboard: true}
	CreateBtn = &BaseMenu.ReplyKeyboard[0][0]
)

Functions

func ApplyFilter

func ApplyFilter(c *UserContext, m *image.RGBA)

func GenerateImages

func GenerateImages(c *UserContext) ([]*image.RGBA, error)

GenerateImages Generate one big image and devices it into two parts images are stored in memory

func GetUserString

func GetUserString(c tele.Context) string

func Start

func Start()

Start bot with token IMAGEN_TOKEN from OS environment variables

Types

type Admins

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

func GetAdmins

func GetAdmins() Admins

func (Admins) Notify

func (a Admins) Notify(what interface{}, c tele.Context) error

type DateHandler

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

DateHandler is a handler for the date input

func (*DateHandler) Handle

func (h *DateHandler) Handle(c *UserContext, t tele.Context) error

func (*DateHandler) Prologue

func (h *DateHandler) Prologue(c *UserContext, t tele.Context) error

func (*DateHandler) SetNext

func (h *DateHandler) SetNext(next Handler) Handler

type FilterHandler

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

FilterHandler is a handler for the filter choice

func (*FilterHandler) Handle

func (h *FilterHandler) Handle(c *UserContext, t tele.Context) error

func (*FilterHandler) Prologue

func (h *FilterHandler) Prologue(c *UserContext, t tele.Context) error

func (*FilterHandler) SetNext

func (h *FilterHandler) SetNext(next Handler) Handler

type FirstNameHandler

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

FirstNameHandler is a handler for the first name input

func (*FirstNameHandler) Handle

func (h *FirstNameHandler) Handle(c *UserContext, t tele.Context) error

func (*FirstNameHandler) Prologue

func (h *FirstNameHandler) Prologue(c *UserContext, t tele.Context) error

func (*FirstNameHandler) SetNext

func (h *FirstNameHandler) SetNext(next Handler) Handler

type GeneratorHandler

type GeneratorHandler struct{}

GeneratorHandler is a handler for the image generation

func (*GeneratorHandler) Handle

func (h *GeneratorHandler) Handle(c *UserContext, t tele.Context) error

func (*GeneratorHandler) Prologue

func (h *GeneratorHandler) Prologue(c *UserContext, t tele.Context) error

func (*GeneratorHandler) SetNext

func (h *GeneratorHandler) SetNext(_ Handler) Handler

type Handler

type Handler interface {
	Handle(c *UserContext, t tele.Context) error
	Prologue(c *UserContext, t tele.Context) error
	SetNext(h Handler) Handler
}

type PromptState

type PromptState int32
const (
	FirstNameInput PromptState = iota
	SecondNameInput
	DateInput
	FilterInput
	ImageOutput
)

type SecondNameHandler

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

SecondNameHandler is a handler for the second name input

func (*SecondNameHandler) Handle

func (h *SecondNameHandler) Handle(c *UserContext, t tele.Context) error

func (*SecondNameHandler) Prologue

func (h *SecondNameHandler) Prologue(c *UserContext, t tele.Context) error

func (*SecondNameHandler) SetNext

func (h *SecondNameHandler) SetNext(next Handler) Handler

type UserContext

type UserContext struct {
	FName  string
	SName  string
	Date   string
	State  PromptState
	Filter string
}

func (*UserContext) String

func (u *UserContext) String() string

Jump to

Keyboard shortcuts

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