package bot import "strings" // startText returns the localized /start welcome body and the launch-button label. // Russian is used when lang (the IETF language tag the Telegram client reports on the // message's sender) starts with "ru", English otherwise and when it is absent — so a // user with no reported language still gets a sensible message. channel and chat are // the resolved public @usernames (without the leading @) of the game channel and the // discussion chat; when either is empty its follow link degrades to a generic noun // (e.g. "the channel" / "our chat") rather than rendering a dangling "@", since the // bot's own info screen still lists the real links. func startText(lang, channel, chat string) (text, button string) { if strings.HasPrefix(strings.ToLower(lang), "ru") { return ruWelcome(channel, chat), "Открыть «Эрудит»" } return enWelcome(channel, chat), "Open “Erudite”" } // ruWelcome builds the Russian welcome. A known handle is named as "@"; an // unresolved one degrades to a plain noun. func ruWelcome(channel, chat string) string { ch := "канал" if channel != "" { ch = "@" + channel } ct := "чате" if chat != "" { ct = "@" + chat } return strings.Join([]string{ "Привет! 👋", "Здесь можно сражаться в «Эрудит» со случайными игроками или в компании друзей.", "Подписывайтесь на " + ch + ", чтобы быть в курсе последних игровых событий и вовремя " + "получать важные уведомления. Игроки могут обсуждать игру и просто общаться в нашем " + ct + "! 💬", "Ни слова больше.\nПервая партия сама себя не сыграет 😊", }, "\n\n") } // enWelcome builds the English welcome (the fallback for any non-Russian or missing // language). A known handle is named as "@"; an unresolved one degrades to a // plain noun. func enWelcome(channel, chat string) string { ch := "the channel" if channel != "" { ch = "@" + channel } ct := "group chat" if chat != "" { ct = "@" + chat } return strings.Join([]string{ "Hi! 👋", "Play Scrabble against random players — or with a group of friends.", "Follow " + ch + " to stay up to date with the latest game events and receive important " + "notifications in time. Players can discuss the game and simply chat in our " + ct + "! 💬", "Okay, no more talking.\nFirst game won't play itself 😊", }, "\n\n") }