Skip to content

Commit

Permalink
Read currency
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaBernstein committed Nov 4, 2021
1 parent a86825a commit 09992b1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bot/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,13 @@ func (bc *BotController) commandSuggestions(m *tb.Message) {
}

func (bc *BotController) commandCurrency(m *tb.Message) {
currency := bc.Repo.UserGetCurrency(m)
values := strings.Split(m.Text, " ")
if len(values) != 2 {
bc.Bot.Send(m.Sender, "Please try again. Expecting currency without spaces. E.g. try '/currency EUR'.")
bc.Bot.Send(m.Sender, fmt.Sprintf("Your current currency is set to '%s'. To change it add the new currency to use to the command like this: '/currency EUR'.", currency))
return
}
currency := values[1]
currency = values[1]
err := bc.Repo.UserSetCurrency(m, currency)
if err != nil {
bc.Bot.Send(m.Sender, "An error ocurred saving your currency preference: "+err.Error())
Expand Down

0 comments on commit 09992b1

Please sign in to comment.