Created
March 2, 2019 20:00
-
-
Save rupython/25bf158cdf6e211f9a5166cb5aae74ca to your computer and use it in GitHub Desktop.
From: Павел
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import telebot | |
from telebot import types | |
token = "766712108:AAEPdk22QMIIfJZGbd8uwDCZgBK5dswQr5Q" | |
bot = telebot.TeleBot(token) | |
ru = [] | |
ua = [] | |
by = [] | |
kz = [] | |
gb = [] | |
my_country = None | |
usfrom = types.ReplyKeyboardMarkup(True) | |
usfrom.add("Россия", "Украина", "Беларусь", "Касахстан", "Я из другой страны") | |
main_menu = types.ReplyKeyboardMarkup(True) | |
main_menu.add("📌 Задания", "💰 Баланс") | |
balance = {} | |
@bot.message_handler(commands = ["start"]) | |
def start(message): | |
bot.send_message(message.chat.id, "Добро пожаловать!") | |
if message.chat.id not in balance: | |
balance[message.chat.id] = 0 | |
a = message.chat.id | |
if a not in (ru, ua, by, kz, gb): | |
msg = bot.send_message(message.chat.id, "Выберите из меню страну своего проживания. Это нужно для правильного подбора заданий.", reply_markup = usfrom) | |
bot.register_next_step_handler(msg, my_country) | |
else: | |
bot.send_message(message.chat.id, "Обнлвение успешно", reply_markup = main_menu) | |
@bot.message_handler(content_types = ["text"]) | |
def my_country(message): | |
b = message.text | |
g = message.chat.id | |
if g not in ru and g not in ua and g not in by and g not in kz and g not in gb: | |
if b == "Россия": | |
ru.append(message.chat.id) | |
if b == "Украина": | |
ua.append(message.chat.id) | |
if b == "Беларусь": | |
by.append(message.chat.id) | |
if b == "Казахстан": | |
kz.append(message.chat.id) | |
if b == "Я из другой страны": | |
gb.append(message.chat.id) | |
bot.send_message(message.chat.id, "Ваша страна успешно сохранена.", reply_markup = main_menu) | |
print(ru, ua, kz, by, gb) | |
bot.polling() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment