Sebastián

Generation

generate functionThu, 13 Jul 2023

Crear un bot para Telegram que tenga la capacidad de realizar operaciones matemáticas Basicas de manera profesional

import time import telepot from telepot.loop import MessageLoop def handle(msg): content_type, chat_type, chat_id = telepot.glance(msg) print(content_type, chat_type, chat_id) if content_type == 'text': bot.sendMessage(chat_id, "You said '{}'".format(msg["text"])) bot = telepot.Bot('1038853634:AAH56qjKNYjb2lRwR9kTcR7B3v2iNnAZWvQ') MessageLoop(bot, handle).run_as_thread() print ('Listening ...') # Keep the program running. while 1: time.sleep(10)

Want to kickstart your project?Use the new AI Studio to create your code