如何解决如何让机器人响应我在电报财务股票中的订单?
我正在为电报创建一个机器人,我想添加一个功能。例如..通过在组股票中写/u
发送价格
/u msft
/u gold
并发送最后的价格。
最后,我还想获得自动更新。仅在写入组 /u msft
时起作用。
感谢并抱歉我的英语不好。
def telegram_bot_sendtext(bot_message):
bot_token='xxxx389537:AAGDTaYAz-htwJV_6n9UEMsce3SgNu7c6XE'
bot_chatID='-xxxx43831'
send_text='https://api.telegram.org/botxxxx389537:AAGDTaYAz-htwJV_6n9UEMsce3SgNu7c6XE/sendMessage?chat_id=-537743831&parse_mode=Markdown&text=' + bot_message
response=requests.get(send_text)
return response.json()
test=telegram_bot_sendtext("Grupo de asesoramiento. Respondo de 11:30 - 18:00")
print(test)
Price= ''
def getStock():
bot_token='xxxx389537:AAGDTaYAz-htwJV_6n9UEMsce3SgNu7c6XE'
bot_chatID='-xxxx43831'
response= "Let me fetch Latest quote for you \n"
symbol='ITC.NS'
aapl=pdr.get_data_yahoo(symbol,start=datetime.datetime(2019,12,14),end=datetime.datetime(2040,14))
price=(aapl["Close"][0]).round(2)
price=str(price)
price="Current price for "+symbol+ " is "+price
price=str(price.encode('utf-8','ignore'),errors='ignore')
send_text='https://api.telegram.org/botxxxx389537:AAGDTaYAz-htwJV_6n9UEMsce3SgNu7c6XE/sendMessage?chat_id=-xxxx43831&parse_mode=Markdown&text=' + price
response=requests.get(send_text)
print(response)
import threading
while True:
getStock()
time.sleep(60)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。