bot

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetArgs

func GetArgs(r security.Request) []string

Split the command from the arguments Receive a user request Return a string slice that have every argument sended by the user

func InsertUserToBooks

func InsertUserToBooks(user int64, books []expiraBot.Books) []expiraBot.Books

The books slice received from crawler don't have the user id Receive as argument the user id and the books slice Return the books slice populate with the user id

func Start

func Start(key string, database expiraBot.Database, debug bool)

func ValidateLogin

func ValidateLogin(login string) bool

Validate the login format Receive a login in a string format Return true if the format is correct, false otherwise

func ValidatePassword

func ValidatePassword(password string) bool

Validate the password format Receive a password in a string format Return true if the format is correct, false otherwise

Types

type Event

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

func (Event) Books

func (e Event) Books(r security.Request)

Books command Send a list of the user's books to the user

func (Event) ErrorCommand

func (e Event) ErrorCommand(r security.Request)

ErrorCommand Send a message to the user when he try to use a invalid command

func (Event) Help

func (e Event) Help(r security.Request)

Help command Send a help message to the user

func (Event) Insert

func (e Event) Insert(r security.Request)

Insert command Insert a book that is passed by argument by the user

func (*Event) Next

func (e *Event) Next(r security.Request)

func (Event) SendBooksMessage

func (e Event) SendBooksMessage(r security.Request, books []expiraBot.Books)

func (Event) SendErrorCommandMessage

func (e Event) SendErrorCommandMessage(r security.Request)

func (Event) SendHelpMessage

func (e Event) SendHelpMessage(r security.Request)

func (Event) SendInsertMessage

func (e Event) SendInsertMessage(r security.Request)

func (Event) SendStartMessage

func (e Event) SendStartMessage(r security.Request)

func (Event) SendUpdateMessage

func (e Event) SendUpdateMessage(r security.Request, message string)

func (Event) Start

func (e Event) Start(r security.Request)

Start command Insert the user in the database and send back a welcome message

func (Event) Update

func (e Event) Update(r security.Request)

Update command Get books of the user on the bu website and insert in the database

Jump to

Keyboard shortcuts

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