Closed juancarlospaco closed 6 years ago
Location works Ok, but its longitude and latitude must be float, at least rounded floats.
import telebot, asyncdispatch, options const API_KEY = "" proc geoHandler(bot: TeleBot): CommandCallback = proc cb(e: Command) {.async.} = let message = newLocation(e.message.chat.id, longitude=42.9, latitude=42.9) discard await bot.send(message) result = cb let bot = newTeleBot(API_KEY) bot.onCommand("geo", geoHandler(bot)) bot.poll(666)
Produces the error:
nim_telegram_bot.nim(234, 22) template/generic instantiation from here nim_telegram_bot.nim(145, 23) template/generic instantiation from here nim_telegram_bot.nim(150, 31) Error: type mismatch: got <longitude: float64, latitude: float64> but expected one of: proc newLocation(chatId: int; latitude: int; longitude: int): LocationObject expression: newLocation(longitude = 42.9, latitude = 42.9)
Change:
let message = newLocation(e.message.chat.id, longitude=42.9, latitude=42.9)
To:
let message = newLocation(e.message.chat.id, longitude=42, latitude=42)
And it works.
https://core.telegram.org/bots/api#location
0.9 on Latitude or Longitude is a lot of terrain.
Seems kinda easy to fix since change type from int to float. Feel free to use the example code.
int
float
Thanks for the epic work on this framework :grey_exclamation: :smiley_cat:
Yay!, thanks pal :grey_exclamation: :tada::cat::+1:
Location works Ok, but its longitude and latitude must be float, at least rounded floats.
Produces the error:
Change:
To:
And it works.
https://core.telegram.org/bots/api#location
0.9 on Latitude or Longitude is a lot of terrain.
Seems kinda easy to fix since change type from
int
tofloat
. Feel free to use the example code.Thanks for the epic work on this framework :grey_exclamation: :smiley_cat: