26 lines
747 B
Go
26 lines
747 B
Go
// Fantasy World Zookeeper Bot
|
|
// Copyright (c) 2018 Vladimir "fat0troll" Hodakov
|
|
|
|
package battlesv1
|
|
|
|
import (
|
|
"gitlab.com/toby3d/telegram"
|
|
itelegram "lab.wtfteam.pro/fat0troll/fw_zookeeper/internal/telegram"
|
|
"strings"
|
|
)
|
|
|
|
// ForwardCommand responds to fight request
|
|
func ForwardCommand(update *telegram.Update) {
|
|
log.Info().Msg("Battle request received!")
|
|
if update.Message.Chat.ID == c.Config.Announces.ChannelID {
|
|
log.Info().Msg("This battle is already posted")
|
|
}
|
|
message := update.Message.Text
|
|
if !strings.Contains(message, "join") {
|
|
message = strings.Replace(message, "fight", "join_fight", 1)
|
|
}
|
|
message = strings.Replace(message, "@FWorldBot ", "", 1)
|
|
|
|
itelegram.RespondWithoutMarkdown(c.Config.Announces.ChannelID, message)
|
|
}
|