bot

package
v0.0.0-...-5a6395a Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EscapeHTML = strings.NewReplacer(`<`, "&lt;", `>`, "&gt;", `&`, "&amp;").Replace

Functions

func ChooseName

func ChooseName(user *tb.User, others []*tb.User) (name string)

func PlayerHTML

func PlayerHTML(cs *chatstate.ChatState, user *tb.User) string

func PlayersHTML

func PlayersHTML(cs *chatstate.ChatState, users []*tb.User) []string

func UserNames

func UserNames(user *tb.User) (names []string)

Types

type Bot

type Bot struct {
	*tb.Bot
	Chats ChatStateMap

	BtnJoin  tb.InlineButton
	BtnLeave tb.InlineButton
	BtnBegin tb.InlineButton
}

func NewBot

func NewBot(b *tb.Bot, local bool, table string) *Bot

func (*Bot) ChatStateMessage

func (b *Bot) ChatStateMessage(cs *chatstate.ChatState) (what string, options []interface{})

func (*Bot) OnAbout

func (b *Bot) OnAbout(m *tb.Message)

func (*Bot) OnAboutID

func (b *Bot) OnAboutID(m *tb.Message)

func (*Bot) OnAboutName

func (b *Bot) OnAboutName(m *tb.Message)

func (*Bot) OnAboutPic

func (b *Bot) OnAboutPic(m *tb.Message)

func (*Bot) OnBtnBegin

func (b *Bot) OnBtnBegin(c *tb.Callback)

func (*Bot) OnBtnJoin

func (b *Bot) OnBtnJoin(c *tb.Callback)

func (*Bot) OnBtnLeave

func (b *Bot) OnBtnLeave(c *tb.Callback)

func (*Bot) OnPlay

func (b *Bot) OnPlay(m *tb.Message)

func (*Bot) OnRules

func (b *Bot) OnRules(m *tb.Message)

func (*Bot) OnStart

func (b *Bot) OnStart(m *tb.Message)

func (*Bot) OnTopics

func (b *Bot) OnTopics(m *tb.Message)

func (*Bot) Post

func (b *Bot) Post(to tb.Recipient, what interface{}, options ...interface{}) (*tb.Message, bool)

func (*Bot) PostChatState

func (b *Bot) PostChatState(chat *tb.Chat, cs *chatstate.ChatState)

func (*Bot) Setup

func (b *Bot) Setup()

func (*Bot) UpdateChatState

func (b *Bot) UpdateChatState(cs *chatstate.ChatState)

type ChatStateMap

type ChatStateMap interface {
	Get(chatID int64) (*chatstate.ChatState, func())
}

type LocalChatStateMap

type LocalChatStateMap struct{ sync.Map }

func NewLocalChatStateMap

func NewLocalChatStateMap() *LocalChatStateMap

func (*LocalChatStateMap) Get

func (m *LocalChatStateMap) Get(chatID int64) (*chatstate.ChatState, func())

type LocalChatStateMapItem

type LocalChatStateMapItem struct {
	sync.Mutex
	chatstate.ChatState
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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