在我的脚本中,我想获取电报机器人所有者的位置,当用户点击按钮时,机器人将所有者的位置以Google地图图像的形式发送给用户。 我的脚本是:获取电报机器人所有者的位置
import telepot
from telepot.loop import MessageLoop
import time
from gps3 import gps3
bot = telepot.Bot('mytoken')
def handle(msg):
content_type, chat_type, chat_id = telepot.glance(msg)
gps_socket = gps3.GPSDSocket()
data_stream = gps3.DataStream()
gps_socket.connect()
gps_socket.watch()
for new_data in gps_socket:
if new_data:
data_stream.unpack(new_data)
alt = data_stream.TPV['alt']
lat = data_stream.TPV['lat']
bot.sendMessage(chat_id , alt)
MessageLoop(bot, handle).run_as_thread()
while 1:
time.sleep(1)
我在我的笔记本上运行此脚本,因为我的笔记本电脑有没有GPS,我得到的错误,当我用我的Android手机上运行它,它应该工作,但我得到了同样的错误
你是什么意思的所有者BOT? –
请问机器人老板。 – samira
你如何期待你的android运行一个python脚本? –