telegram

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

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

Go to latest
Published: May 23, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AchievementClown    = "clown"
	AchievementMedal    = "medal"
	AchievementHeart    = "heart"
	AchievementMoney    = "money"
	AchievementMoneys   = "moneys"
	AchievementMoneyOne = "moneyOne"
	AchievementSkull    = "skull"
	AchievementInc      = "inc"
	AchievementDec      = "dec"
	AchievementHole     = "hole"
	AchievementLike     = "like"
	AchievementTime     = "time"
	AchievementFun      = "fun"
)

Определение констант для названий достижений

View Source
const PREFIX_CANCEL_VOTE = "🛑"
View Source
const PREFIX_DOWN_VOTE = "➖"
View Source
const PREFIX_UP_VOTE = "➕"

Variables

View Source
var AchievementsEmoji = map[string]string{
	AchievementClown:    "🤡",
	AchievementMedal:    "🏅",
	AchievementHeart:    "❤️",
	AchievementMoney:    "💰",
	AchievementMoneys:   "💵",
	AchievementMoneyOne: "💲",
	AchievementSkull:    "💀",
	AchievementHole:     "🕳️",
	AchievementLike:     "👍",
	AchievementTime:     "⌚",
	AchievementFun:      "😄",
}

Определение map для сопоставления названий достижений с emoji

Functions

func InlineKeyboardButtonMarkup

func InlineKeyboardButtonMarkup(userId int64) tgbotapi.InlineKeyboardMarkup

Types

type Bot

type Bot struct {
	Services *service.Services
	// contains filtered or unexported fields
}

func NewBot

func NewBot(
	bot *tgbotapi.BotAPI,
	con *config.IniConf,
	version string,
	messages config.Messages,
	chatRepository storage.ChatRepository,
	services *service.Services,
) *Bot

func (*Bot) AddAchievement

func (b *Bot) AddAchievement(user models.User, achievement string) (models.User, error)

func (*Bot) AddScore

func (b *Bot) AddScore(user models.User, score int64) (models.User, error)

func (*Bot) CreateAchievementPoll

func (b *Bot) CreateAchievementPoll(message *tgbotapi.Message) error

func (*Bot) CreateRatePoll

func (b *Bot) CreateRatePoll(message *tgbotapi.Message) error

func (*Bot) CronInit

func (b *Bot) CronInit(scheduler *cron.Cron)

func (*Bot) CronStart

func (b *Bot) CronStart()

func (*Bot) GenerateImageUserCard

func (b *Bot) GenerateImageUserCard(user models.User) ([]byte, error)

func (*Bot) GetUserProfile

func (b *Bot) GetUserProfile(message *tgbotapi.Message) error

func (*Bot) ReduceScore

func (b *Bot) ReduceScore(user models.User, score int64) (models.User, error)

func (*Bot) SendCallbackAnswer

func (b *Bot) SendCallbackAnswer(query *tgbotapi.CallbackQuery, text string)

func (*Bot) SendTestMessage

func (b *Bot) SendTestMessage(message *tgbotapi.Message) error

func (*Bot) SendWelcomeMessage

func (b *Bot) SendWelcomeMessage(chatId int64)

func (*Bot) Start

func (b *Bot) Start() error

func (*Bot) StopRatePoll

func (b *Bot) StopRatePoll(message *tgbotapi.Message) error

type RatePollResult

type RatePollResult struct {
	Positive int
	Negative int
	Canceled int
	Medal    int
	Clown    int
	Heart    int
	Like     int
	Fun      int
	Skull    int
	Hole     int
}

type RatePollResultType

type RatePollResultType uint
const (
	VOTE_UP     RatePollResultType = 0
	VOTE_DOWN   RatePollResultType = 1
	VOTE_CANCEL RatePollResultType = 2

	ADD_MEDAL RatePollResultType = 3
	ADD_CLOWN RatePollResultType = 4
	ADD_HEART RatePollResultType = 5
	ADD_LIKE  RatePollResultType = 6
	ADD_FUN   RatePollResultType = 7
	ADD_SKULL RatePollResultType = 8
	ADD_HOLE  RatePollResultType = 9
)

type Sprite

type Sprite struct {
	Name   string
	X, Y   int // Позиция спрайта по X, U (столбец, строка начиная с 0)
	Width  int
	Height int
}

type UserAchievements

type UserAchievements struct {
	Achievements map[string]int
}

func NewUserAchievements

func NewUserAchievements() *UserAchievements

NewUserAchievements создает новый экземпляр UserAchievements

func (*UserAchievements) AddAchievement

func (ua *UserAchievements) AddAchievement(name string, count int)

AddAchievement добавляет или обновляет достижение

func (*UserAchievements) DecrementAchievement

func (ua *UserAchievements) DecrementAchievement(name string)

DecrementAchievement уменьшает количество достижений на 1

func (*UserAchievements) GetAchievement

func (ua *UserAchievements) GetAchievement(name string) (int, bool)

GetAchievement возвращает количество достижений по названию

func (*UserAchievements) IncrementAchievement

func (ua *UserAchievements) IncrementAchievement(name string)

IncrementAchievement увеличивает количество достижений на 1

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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