def handle(msg):
"""
This function handle all messages incoming from users
"""
content_type, chat_type, chat_id = telepot.glance(msg)
command_input = msg['text']
if command_input == '/start':
# Check if already registred
if register_user(chat_id):
bot.sendMessage(chat_id, start_msg)
feed = feedparser.parse(feed_url)
# Send all news from older to newest
for entry in reversed(feed.entries):
msg = entry.title + '\n' + entry.link
bot.sendMessage(chat_id, msg)
if command_input == '/stop':
bot.sendMessage(chat_id, stop_msg)
remove_user(chat_id)
评论列表
文章目录