如何在电报机器人中使用坐标回复位置?



如何在电报机器人中使用坐标回复位置?

bot.hears(/coords (.+(/, (ctx( => ctx.replyWithLocation(ctx.message.location.latitude+','+ctx.message.location.longitude((

例 :/coords 40.123456, 1.123456

电报机器人 : 查看地图

电报中用键盘介绍的坐标,并查看地图 接下来。

什么是 telegraf bot.hears 中的代码??

像这样:

机器人:引入坐标?

用户:41.123,2.123

机器人:查看地图

bot.hears(/coords (.+(/, (ctx( => ctx.replyWithLocation(ctx.message.location.latitude+','+ctx.message.location.longitude((

使用ctx.telegram.sendLocation方法:

bot.command("/sendlocation", (ctx) => {
bot.ctx.telegram.sendLocation(chat id , latitude, longitude)
)}

最新更新