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

from telegram.ext import Updater, CommandHandler def welcome(bot, update): bot.send_message(chat_id=update.message.chat_id, text="Welcome to the PythonMathBot") def cuadrado(bot, update, args): try: value = float(args[0]) bot.send_message(chat_id=update.message.chat_id, text=value**2) except (ValueError, IndexError): bot.send_message(chat_id=update.message.chat_id, text="Uso: /cuadrado <numero>") def raiz(bot, update, args): try: value = float(args[0]) bot.send_message(chat_id=update.message.chat_id, text=value**0.5) except (ValueError, IndexError): bot.send_message(chat_id=update.message.chat_id, text="Uso: /raiz <numero>") def resta(bot

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