vote

package
v0.0.0-...-87370ed Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const HelpMessage = `` /* 149-byte string literal not displayed */

HelpMessage - show help message.

Variables

This section is empty.

Functions

func NewPayment

func NewPayment()

Types

type Bot

type Bot struct {
	tb.Bot

	Unique  int
	Config  *Config
	Vote    *Vote
	Pinned  tb.Editable
	Channel *tb.Chat
}

Bot - represent a separate telegram bot instance.

func NewBot

func NewBot(s tb.Settings, config *Config) (*Bot, error)

NewBot - return new Bot instance.

func (*Bot) CreateHandlers

func (b *Bot) CreateHandlers()

CreateHandlers - create handlers for buttons.

func (*Bot) CreateVote

func (b *Bot) CreateVote() error

CreateVote - creating new message for voting.

func (*Bot) GetPinnedMessage

func (b *Bot) GetPinnedMessage(chatID int) (*PinnedMessage, error)

GetPinnedMessage - return pinned message in chat by id.

func (*Bot) GetVoteResult

func (b *Bot) GetVoteResult() string

GetVoteResult - return result of current vote.

func (*Bot) PinMessage

func (b *Bot) PinMessage(m *tb.Message) error

PinMessage - pin message in chat.

func (*Bot) SendReminder

func (b *Bot) SendReminder()

SendReminder - send reminder for players.

func (*Bot) UnpinMessage

func (b *Bot) UnpinMessage() error

UnpinMessage - unpin message in current chat.

func (*Bot) UpdateVote

func (b *Bot) UpdateVote() error

UpdateVote - update vote.

type Config

type Config struct {
	APIToken string
	Appeals  []string
	Place    struct {
		URL      string
		Location struct {
			Latitude  float64
			Longitude float64
		}
	}
	Formats struct {
		VoteFormat   string
		ResultFormat string
		RemindFormat string
	}
	NoResult string
	Weekday  int
	Hour     int
	Minute   int
	Admins   []string
	God      string
}

Config - telegram bot configuration.

func NewConfig

func NewConfig() *Config

NewConfig - return new config instance

type PinnedMessage

type PinnedMessage struct {
	ID   float64 `json:"message_id"`
	Date float64
	Text string
	From struct {
		Username string
		IsBot    bool `json:"is_bot"`
	}
	Chat struct {
		ID float64
	}
}

PinnedMessage - raw telegram api pinned message.

func (*PinnedMessage) MessageSig

func (pm *PinnedMessage) MessageSig() (string, int64)

MessageSig - to implement telebot.Edditable

type Vote

type Vote struct {
	Format     string
	RandAppeal string
}

Vote - struct for vote.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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