mirror of
https://github.com/dyrkin/luxmed-bot.git
synced 2025-12-21 13:23:05 +01:00
Display current account in the account chat header
This commit is contained in:
@@ -39,8 +39,9 @@ class Account(val userId: UserId, bot: Bot, dataService: DataService, val locali
|
||||
whenSafe(AskAction) {
|
||||
case Event(Next, _) =>
|
||||
val credentials = dataService.getUserCredentials(userId.userId)
|
||||
val currentAccount = credentials.find(c => c.accountId == userId.accountId).getOrElse(sys.error("Can't determine current account"))
|
||||
val buttons = Seq(Button(lang.addAccount, -1L), Button(lang.deleteAccount, -2L)) ++ credentials.map(c => Button(s"🔐️ ${c.username}", c.accountId))
|
||||
bot.sendMessage(userId.source, lang.pleaseChooseAccount, inlineKeyboard = createInlineKeyboard(buttons, columns = 1))
|
||||
bot.sendMessage(userId.source, lang.pleaseChooseAccount(currentAccount.username), inlineKeyboard = createInlineKeyboard(buttons, columns = 1))
|
||||
goto(AwaitAction)
|
||||
}
|
||||
|
||||
|
||||
@@ -361,5 +361,8 @@ object En extends Lang {
|
||||
override def accountSwitched(username: String): String =
|
||||
s"✅ Account has been switched to <b>$username</b>"
|
||||
|
||||
override def pleaseChooseAccount: String = "<b>➡</b> Please choose an <b>action</b> or select <b>account</b>"
|
||||
override def pleaseChooseAccount(currentAccountName: String): String =
|
||||
s"""Current account is <b>$currentAccountName</b>
|
||||
|
|
||||
|<b>➡</b> Please choose an <b>action</b> or select <b>account</b>""".stripMargin
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ trait Lang {
|
||||
|
||||
def addAccount: String
|
||||
|
||||
def pleaseChooseAccount: String
|
||||
def pleaseChooseAccount(currentAccountName: String): String
|
||||
|
||||
def accountSwitched(username: String): String
|
||||
}
|
||||
|
||||
@@ -360,5 +360,8 @@ object Ua extends Lang {
|
||||
override def accountSwitched(username: String): String =
|
||||
s"✅ Аккаунт було переключено на <b>$username</b>"
|
||||
|
||||
override def pleaseChooseAccount: String = "<b>➡</b> Будь ласка, оберіть <b>дію</b> або виберіть <b>акаунт</b>"
|
||||
override def pleaseChooseAccount(currentAccountName: String): String =
|
||||
s"""Поточний акаунт <b>$currentAccountName</b>
|
||||
|
|
||||
|<b>➡</b> Будь ласка, оберіть <b>дію</b> або виберіть <b>акаунт</b>""".stripMargin
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user