Archived
1

Pinner fix for lost spaces

This commit is contained in:
Vladimir Hodakov 2017-12-03 00:40:30 +04:00
parent 4d941454b5
commit dfda32396a
4 changed files with 21 additions and 13 deletions

View File

@ -87,7 +87,7 @@ func (p *Pinner) PinMessageToSomeChats(update *tgbotapi.Update) string {
if i == 0 { if i == 0 {
chatsToPin = commandArgsList[i] chatsToPin = commandArgsList[i]
} else { } else {
messageToPin += commandArgsList[i] messageToPin += commandArgsList[i] + " "
} }
} }

View File

@ -62,22 +62,24 @@ func (r *Router) routeGroupRequest(update *tgbotapi.Update, playerRaw *dbmapping
if trigger == 4 { if trigger == 4 {
switch { switch {
case huMsg.MatchString(text): case huMsg.MatchString(text):
c.Talkers.MatMessage(update) return c.Talkers.MatMessage(update)
case blMsg.MatchString(text): case blMsg.MatchString(text):
c.Talkers.MatMessage(update) return c.Talkers.MatMessage(update)
case ebMsg.MatchString(text): case ebMsg.MatchString(text):
c.Talkers.MatMessage(update) return c.Talkers.MatMessage(update)
case piMsg.MatchString(text): case piMsg.MatchString(text):
c.Talkers.MatMessage(update) return c.Talkers.MatMessage(update)
case durakMsg.MatchString(text): case durakMsg.MatchString(text):
c.Talkers.DurakMessage(update) return c.Talkers.DurakMessage(update)
} }
} }
switch { switch {
case update.Message.Command() == "long": case update.Message.Command() == "long":
c.Talkers.LongMessage(update) return c.Talkers.LongMessage(update)
} }
// Ah, we're still here
return "ok" return "ok"
} }

View File

@ -10,7 +10,7 @@ import (
) )
// LongMessage is an easter egg // LongMessage is an easter egg
func (t *Talkers) LongMessage(update *tgbotapi.Update) { func (t *Talkers) LongMessage(update *tgbotapi.Update) string {
message := "Я ТЕБЕ НЕ ЗЕЛЁНЫЙ АКСОЛОТЛЬ! А ТЫ - НЕ ЦИФЕРКА!" message := "Я ТЕБЕ НЕ ЗЕЛЁНЫЙ АКСОЛОТЛЬ! А ТЫ - НЕ ЦИФЕРКА!"
trigger := rand.Intn(5) trigger := rand.Intn(5)
if trigger > 3 { if trigger > 3 {
@ -23,10 +23,12 @@ func (t *Talkers) LongMessage(update *tgbotapi.Update) {
msg.ReplyToMessageID = update.Message.MessageID msg.ReplyToMessageID = update.Message.MessageID
c.Bot.Send(msg) c.Bot.Send(msg)
return "ok"
} }
// DurakMessage is an easter egg // DurakMessage is an easter egg
func (t *Talkers) DurakMessage(update *tgbotapi.Update) { func (t *Talkers) DurakMessage(update *tgbotapi.Update) string {
reactions := make([]string, 0) reactions := make([]string, 0)
reactions = append(reactions, "Сам такой!", reactions = append(reactions, "Сам такой!",
"А ты типа нет?", "А ты типа нет?",
@ -43,10 +45,12 @@ func (t *Talkers) DurakMessage(update *tgbotapi.Update) {
msg.ReplyToMessageID = update.Message.MessageID msg.ReplyToMessageID = update.Message.MessageID
c.Bot.Send(msg) c.Bot.Send(msg)
return "ok"
} }
// MatMessage is an easter rgg // MatMessage is an easter rgg
func (t *Talkers) MatMessage(update *tgbotapi.Update) { func (t *Talkers) MatMessage(update *tgbotapi.Update) string {
reactions := make([]string, 0) reactions := make([]string, 0)
reactions = append(reactions, "Фу, как некультурно!", reactions = append(reactions, "Фу, как некультурно!",
"Иди рот с мылом помой", "Иди рот с мылом помой",
@ -60,4 +64,6 @@ func (t *Talkers) MatMessage(update *tgbotapi.Update) {
msg.ReplyToMessageID = update.Message.MessageID msg.ReplyToMessageID = update.Message.MessageID
c.Bot.Send(msg) c.Bot.Send(msg)
return "ok"
} }

View File

@ -19,7 +19,7 @@ type TalkersInterface interface {
AnyMessageUnauthorized(update *tgbotapi.Update) string AnyMessageUnauthorized(update *tgbotapi.Update) string
BotError(update *tgbotapi.Update) string BotError(update *tgbotapi.Update) string
LongMessage(update *tgbotapi.Update) LongMessage(update *tgbotapi.Update) string
DurakMessage(update *tgbotapi.Update) DurakMessage(update *tgbotapi.Update) string
MatMessage(update *tgbotapi.Update) MatMessage(update *tgbotapi.Update) string
} }