This commit is contained in:
lyx0 2021-10-23 20:43:39 +02:00
parent 9a4a3d2874
commit 4dcef064b6
2 changed files with 3 additions and 1 deletions

View file

@ -39,6 +39,7 @@ type currencyResponse struct {
// https://api.frankfurter.app/latest?amount=10&from=gbp&to=usd
// Currency returns the exchange rate for a given given amount to another.
func Currency(currAmount string, currFrom string, currTo string) (string, error) {
baseUrl := "https://api.frankfurter.app"
currFromUpper := strings.ToUpper(currFrom)

View file

@ -70,13 +70,14 @@ func Command(message twitch.PrivateMessage, nb *bot.Bot) {
commands.Color(message, nb)
return
// ()currency 10 gbp to usd
case "currency":
if msgLen <= 4 {
nb.Send(target, "Usage: ()currency 10 usd to eur, only 3 letter codes work.")
return
}
commands.Currency(target, cmdParams[1], cmdParams[2], cmdParams[4], nb)
return
case "echo":
commands.Echo(target, message.Message[7:len(message.Message)], nb)
return