bot

package
v0.0.0-...-20a9ef9 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelToLanguage

func ChannelToLanguage(channel *model.Channel) config.Language

func CitiesToFields

func CitiesToFields(cities map[string][]string) []*model.SlackAttachmentField

func NewRocketIDsPresent

func NewRocketIDsPresent(message *Message, prevMsg *Message) bool

func Render

func Render(msg *Message, lang config.Language) *model.Post

Types

type Bot

type Bot struct {
	IsOnline bool
	Client   *model.Client4

	ConfigChannel *model.Channel

	Monitoring monitoring.Monitoring
	// contains filtered or unexported fields
}

func (*Bot) AwaitMessage

func (b *Bot) AwaitMessage()

func (*Bot) Cleanup

func (b *Bot) Cleanup()

func (*Bot) Connect

func (b *Bot) Connect()

func (*Bot) Disconnect

func (b *Bot) Disconnect()

func (*Bot) FindBotChannel

func (b *Bot) FindBotChannel()

func (*Bot) GetPrevMsgs

func (b *Bot) GetPrevMsgs(message *Message) (map[district.ID]*Message, map[district.ID]bool)

func (*Bot) LoginAsTheBotUser

func (b *Bot) LoginAsTheBotUser()

func (*Bot) MakeSureServerIsRunning

func (b *Bot) MakeSureServerIsRunning()

func (*Bot) Register

func (b *Bot) Register()

func (*Bot) SubmitMessage

func (b *Bot) SubmitMessage(m *Message)

func (*Bot) UpdateMonitor

func (b *Bot) UpdateMonitor(m *Message)

type Message

type Message struct {
	Instructions   string
	Category       string
	SafetySeconds  uint
	Cities         []district.ID
	RocketIDs      map[string]bool
	Rendered       map[config.Language]*model.Post
	Expire         time.Time
	PostMutex      sync.Mutex
	PostIDs        []string
	ChannelsPosted []*model.Channel
	Changed        bool
	PubDate        string
}

func NewMessage

func NewMessage(instructions string, category string, safetySeconds int, pubDate string) Message

func (*Message) AppendDistrict

func (m *Message) AppendDistrict(districtID district.ID)

func (*Message) GetHash

func (m *Message) GetHash() string

func (*Message) IsExpired

func (m *Message) IsExpired() bool

func (*Message) PatchData

func (m *Message) PatchData(n *Message) bool

func (*Message) PatchPosts

func (m *Message) PatchPosts(b *Bot)

func (*Message) PostForChannel

func (m *Message) PostForChannel(c *model.Channel) *model.Post

func (*Message) Prerender

func (m *Message) Prerender()

Jump to

Keyboard shortcuts

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