Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # pip install pyTelegramBotAPI
- # PythonMyanmar_bot
- import random
- import telebot
- from telebot.types import ReplyKeyboardMarkup, KeyboardButton
- import os
- API_TOKEN = '6755851932:AAHE0EP6aX7As10QF7YnDmHJB9E4dor-u7k'
- user_input = ""
- digit = 0
- count = 0
- bot = telebot.TeleBot(API_TOKEN)
- @bot.message_handler(commands=['start']) #/start
- def start(message):
- bot.reply_to(message, "enter digits (1,2,3,4,etc...)")
- # Handle all other messages with content_type 'text' (content_types defaults to ['text'])
- @bot.message_handler(func=lambda message: True)
- def online_class(message):
- global digit
- user_input = message.text
- match(user_input):
- case 'a':
- digit = 1
- n1 = 9
- bot.reply_to(message, f'You will be adding/substracting numbers between -{n1} and {n1}!')
- bot.reply_to(message, "How many numbers to add/ substract?")
- case 'b':
- digit = 2
- n1 = 99
- bot.reply_to(message, f'You will be adding/substracting numbers between -{n1} and {n1}!')
- bot.reply_to(message, "How many numbers to add/ substract?")
- case 'c':
- digit = 3
- n1 = 999
- bot.reply_to(message, f'You will be adding/substracting numbers between -{n1} and {n1}!')
- bot.reply_to(message, "How many numbers to add/ substract?")
- case '2':
- bot.reply_to(message, "2")
- bot.reply_to(message, "digit is " + str(digit))
- match(digit):
- case 1:
- num1 = random.randint(-9,9)
- num2 = random.randint(-9,9)
- bot.reply_to(message, f"{num1} + {num2} = ?")
- case 2:
- num1 = random.randint(10,99)
- num2 = random.randint(10,99)
- s1 = random.randint(0,1)
- s2 = random.randint(0,1)
- if(s1==1):
- num1 = num1 * -1
- if(s2==1):
- num2 = num2 * -1
- bot.reply_to(message, f"{num1} + {num2} = ?")
- case 3:
- num1 = random.randint(100,999)
- num2 = random.randint(100,999)
- s1 = random.randint(0,1)
- s2 = random.randint(0,1)
- if(s1==1):
- num1 = num1 * -1
- if(s2==1):
- num2 = num2 * -1
- bot.reply_to(message, f"{num1} + {num2} = ?")
- case '3':
- match(digit):
- case 1:
- bot.reply_to(message, "1 + 1 + 1= ?")
- case 2:
- bot.reply_to(message, "11 + 11 + 11= ?")
- case 3:
- bot.reply_to(message, "111 + 111 + 111= ?")
- case '4':
- match(digit):
- case 1:
- bot.reply_to(message, "1 + 1 + 1 + 1= ?")
- case 2:
- bot.reply_to(message, "11 + 11 + 11 + 11 = ?")
- case 3:
- bot.reply_to(message, "111 + 111 + 111+ 111= ?")
- bot.infinity_polling()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement