Documentation ¶
Index ¶
- Constants
- Variables
- func InlineKeyboardButtonMarkup(userId int64) tgbotapi.InlineKeyboardMarkup
- type Bot
- func (b *Bot) AddAchievement(user models.User, achievement string) (models.User, error)
- func (b *Bot) AddScore(user models.User, score int64) (models.User, error)
- func (b *Bot) CreateAchievementPoll(message *tgbotapi.Message) error
- func (b *Bot) CreateRatePoll(message *tgbotapi.Message) error
- func (b *Bot) CronInit(scheduler *cron.Cron)
- func (b *Bot) CronStart()
- func (b *Bot) GenerateImageUserCard(user models.User) ([]byte, error)
- func (b *Bot) GetUserProfile(message *tgbotapi.Message) error
- func (b *Bot) ReduceScore(user models.User, score int64) (models.User, error)
- func (b *Bot) SendCallbackAnswer(query *tgbotapi.CallbackQuery, text string)
- func (b *Bot) SendTestMessage(message *tgbotapi.Message) error
- func (b *Bot) SendWelcomeMessage(chatId int64)
- func (b *Bot) Start() error
- func (b *Bot) StopRatePoll(message *tgbotapi.Message) error
- type RatePollResult
- type RatePollResultType
- type Sprite
- type UserAchievements
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 ¶
func (*Bot) AddAchievement ¶
func (*Bot) CreateAchievementPoll ¶
func (*Bot) GenerateImageUserCard ¶
func (*Bot) ReduceScore ¶
func (*Bot) SendCallbackAnswer ¶
func (b *Bot) SendCallbackAnswer(query *tgbotapi.CallbackQuery, text string)
func (*Bot) SendWelcomeMessage ¶
type RatePollResult ¶
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 UserAchievements ¶
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
Source Files ¶
Click to show internal directories.
Click to hide internal directories.