예제 #1
0
    duck_computer = 'CAACAgIAAxkBAANfXixeTZOVghaTeLpBdT41ROGREIUAAkYAA1KJkSP4_uXkCtUKHRgE',
    duck_thumb_up = 'CAACAgIAAxkBAANgXixe3_aJbju4ehsi0mED-Gi31hQAAkEAA1KJkSPV1ldK02RxVhgE',
    yepekayee = 'CAACAgIAAxkBAANkXixhqxjbEtOCa-rOxj8xmaaOQF8AAsYCAAJjK-IJzec08mzFJQ4YBA',
    baboon_heart = 'CAACAgIAAxkBAANoXixid7nwjH0dLYxLV54zPN9cXTAAApsAAzDUnREDE1nXR8X0jhgE',
    monkey_crazy = 'CAACAgIAAxkBAANqXixisVRlSohB-qrMvQozBbPBImIAAqgAAzDUnRG1yvu41nOKaRgE',
    bewarethedog = 'CAACAgIAAxkBAANsXixjMNr5HyvzHcFNklLrTaerayoAAvMBAALKAwYLGs1jmaU905IYBA',
    toy_duck_vietnam = 'CAACAgIAAxkBAANwXixjx9uZ4ywhisSFcYCTNxs9ts0AAvQAA1advQoRWLD12f1VSRgE',
    freeman_heart = 'CAACAgQAAxkBAANyXixkAmZbDpqezKBvxu_aoQIUoPcAAk8AA4Nq0BCBCEYaEB0fERgE',
    freeman_popcorn = 'CAACAgQAAxkBAAN0XixkKLAYs3O5xF-C2I0JOIVF79EAAkYAA4Nq0BBn0J1SRIJsCxgE',
    banana_screamer = 'CAACAgIAAxkBAAOZXixs5mamFHzpS3xp-QiEHhCZia8AAvECAAK1cdoGcSIxNd9nDrAYBA',
    tiecat_ok = 'CAACAgIAAxkBAAOdXixtLP24XmVIcvoPRRp2m0R1_ukAAhwAA5afjA6Z1Gm-YvJ55RgE',
    duck_phonechat = 'CAACAgIAAxkBAAOfXixtV3Avra3WMw3H21MWUY148xkAAkIAA1KJkSODyFRjM7vkWRgE',
)

admin_markup = types.ReplyKeyboardMarkup(row_width=2, one_time_keyboard=True)
getcachebtn = types.KeyboardButton('/getcache')
terminatebtn = types.KeyboardButton('/terminate')
admin_markup.add(getcachebtn, terminatebtn)

def is_cache_actual():
    return datetime.datetime.fromtimestamp(os.path.getmtime(cache_path)).date() == datetime.date.today()

def get_cache_reports():
    if os.path.isfile(cache_path) and is_cache_actual():
        with open(cache_path, 'r', encoding='utf-8') as tfile:
            reports = json.loads(tfile.read())
    else:
        reports = dict()
    os.remove(cache_path) if not is_cache_actual() else None
    return reports
예제 #2
0
              '😣': '(>_<)',
              '🙄': '( ⚆ _ ⚆ )',
              '😳': '(⊙_⊙)',
              '😡': 'ᕙ(˵•̀෴•́˵)ᕗ',
              '🙂': '(ツ)',
              '😒': '(¬_¬)',
              '☹': '(´◕︵◕`)',
              '😄': '^‿^',
              '😍': 'ヽ(♡‿♡)ノ',
              '🤗': '༼ つ ◕_◕ ༽つ',
              '😊': '(◔‿◔)',
              '🤨': '( ͠° ͟ʖ ͡°)',
              '🙋‍♂️': '⊂(◉‿◉)つ',
              'lenny': '( ͡° ͜ʖ ͡°)',
              '🖕': '( ︶︿︶)_╭∩╮',
              'idk': '¯\\_(⊙︿⊙)_/¯', }

emote_buttons = [types.KeyboardButton(emote) for emote in emote_dict.values()]
emote_keyboard = types.ReplyKeyboardMarkup(row_width=3)
emote_keyboard.add(*emote_buttons)

inline_all_results = [types.InlineQueryResultArticle(i, emote, types.InputTextMessageContent(emote)) for i, emote in
                      enumerate(emote_dict.values())]


def get_inline_results(q):
    if q in emote_dict:
        return [types.InlineQueryResultArticle('1', emote_dict[q], types.InputTextMessageContent(emote_dict[q]))]
    else:
        return inline_all_results
예제 #3
0
                  open('user_data.json', 'w', encoding='utf-8'),
                  indent=2,
                  ensure_ascii=False)
    else:
        redis_db1 = redis.from_url(redis_url)
        redis_db1.set('user_data', json.dumps(user_data))


MAIN_STATE = 'main'
ANSWER_STATE = 'answer_handler'
FIRST_SYMBOL_STATE = 'first_symbol_handler'

markup = types.ReplyKeyboardMarkup(resize_keyboard=True,
                                   one_time_keyboard=False)
markup.add(*[
    types.KeyboardButton(button) for button in [
        'Спроси меня слово', 'Первая буква', 'Покажи счет', 'Сбросить счет',
        'Привет', 'Что мне делать?'
    ]
])

markup1 = types.ReplyKeyboardMarkup(resize_keyboard=True,
                                    one_time_keyboard=True)
markup1.add(*[
    types.KeyboardButton(button) for button in [
        'а', 'б', 'в', 'г', 'д', 'е', 'ж', 'з', 'и', 'к', 'л', 'м', 'н', 'о',
        'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'э', 'Сброс',
        'Что мне делать?'
    ]
])
예제 #4
0
def callback_inline(call):
    if call.message:
        if call.data == "okay":
            global attempts
            attempts = 3
            markup = types.ReplyKeyboardMarkup(one_time_keyboard=False, resize_keyboard = True)
            button = types.KeyboardButton(text='💸Заработать')
            button4 = types.KeyboardButton(text='💼Партнёрство')
            button2 = types.KeyboardButton(text='💰Вывод')
            button3 = types.KeyboardButton(text='🤑Больше денег')
            markup.add(button,button4, button2, button3)

            bot.send_message(call.message.chat.id, '⬇️ Выбери интересующий тебя пункт меню!', reply_markup=markup)

        if call.data[0] == "c":
            print("maladec")
            with open(str(idik) + ".txt", "w+") as f:
                f.write("1200")
            foto = open('paris.jpg', 'rb')
            keyboard = types.InlineKeyboardMarkup(row_width=2)
            a1 = types.InlineKeyboardButton(text="1️⃣", callback_data="a1")
            a2 = types.InlineKeyboardButton(text="2️⃣", callback_data="v2")
            a3 = types.InlineKeyboardButton(text="3️⃣", callback_data="a3")
            a4 = types.InlineKeyboardButton(text="4️⃣", callback_data="a4")

            keyboard.add(a1, a2, a3, a4)
            bot.send_photo(call.message.chat.id, foto)
            bot.send_message(call.message.chat.id,"""✅Правильный ответ! Вы заработали 600 тенге
❓ Страна на 1200 тенге
1️⃣  Сингапур
2️⃣  Франция
3️⃣  Великобритания
4️⃣  США""", reply_markup=keyboard)


        if call.data[0] == "v":
            print("maladec")
            with open(str(idik) + ".txt", "w+") as f:
                f.write("2400")
            foto = open('brazil.jpg', 'rb')
            keyboard = types.InlineKeyboardMarkup(row_width=2)
            a1 = types.InlineKeyboardButton(text="1️⃣", callback_data="a1")
            a2 = types.InlineKeyboardButton(text="2️⃣", callback_data="a2")
            a3 = types.InlineKeyboardButton(text="3️⃣", callback_data="a3")
            a4 = types.InlineKeyboardButton(text="4️⃣", callback_data="b4")

            keyboard.add(a1, a2, a3, a4)
            bot.send_photo(call.message.chat.id, foto)
            bot.send_message(call.message.chat.id,"""✅Правильный ответ! Вы заработали 1200 тенге
❓ Страна на 1800 тенге
1️⃣  Испания
2️⃣  Италия
3️⃣  Франция
4️⃣  Бразилия""", reply_markup=keyboard)

        if call.data[0] == "b":
            print("maladec")
            with open(str(idik) + ".txt", "w+") as f:
                f.write("4000")
            foto = open('china.jpg', 'rb')
            keyboard = types.InlineKeyboardMarkup(row_width=2)
            a1 = types.InlineKeyboardButton(text="1️⃣", callback_data="a1")
            a2 = types.InlineKeyboardButton(text="2️⃣", callback_data="a2")
            a3 = types.InlineKeyboardButton(text="3️⃣", callback_data="n3")
            a4 = types.InlineKeyboardButton(text="4️⃣", callback_data="a4")

            keyboard.add(a1, a2, a3, a4)
            bot.send_photo(call.message.chat.id, foto)
            bot.send_message(call.message.chat.id,"""✅Правильный ответ! Вы заработали 1800 тенге
❓ Страна на 2400 тенге
1️⃣  Малайзия
2️⃣  Испания
3️⃣  Китай
4️⃣  Индия""", reply_markup=keyboard)

        if call.data[0] == "n":
            print("maladec")
            with open(str(idik) + ".txt", "w+") as f:
                f.write("6400")
            foto = open('dubai.jpg', 'rb')
            keyboard = types.InlineKeyboardMarkup(row_width=2)
            a1 = types.InlineKeyboardButton(text="1️⃣", callback_data="a1")
            a2 = types.InlineKeyboardButton(text="2️⃣", callback_data="m2")
            a3 = types.InlineKeyboardButton(text="3️⃣", callback_data="a3")
            a4 = types.InlineKeyboardButton(text="4️⃣", callback_data="a4")

            keyboard.add(a1, a2, a3, a4)
            bot.send_photo(call.message.chat.id, foto)
            bot.send_message(call.message.chat.id,"""✅Правильный ответ! Вы заработали 2400 тенге
❓ Страна на 3600 тенге
1️⃣  Иран
2️⃣  ОЭА
3️⃣  Малайзия
4️⃣  Китай""", reply_markup=keyboard)

        if call.data[0] == "m":
            print("maladec")
            with open(str(idik) + ".txt", "w+") as f:
                f.write("10000")
            foto = open('malaysia.jpg', 'rb')
            keyboard = types.InlineKeyboardMarkup(row_width=2)
            a1 = types.InlineKeyboardButton(text="1️⃣", callback_data="a1")
            a2 = types.InlineKeyboardButton(text="2️⃣", callback_data="z2")
            a3 = types.InlineKeyboardButton(text="3️⃣", callback_data="a3")
            a4 = types.InlineKeyboardButton(text="4️⃣", callback_data="a4")

            keyboard.add(a1, a2, a3, a4)
            bot.send_photo(call.message.chat.id, foto)
            bot.send_message(call.message.chat.id,"""✅Правильный ответ! Вы заработали 3600 тенге
❓ Страна на 7200 тенге
1️⃣  Египет
2️⃣  Малайзия
3️⃣  Испания
4️⃣  Турция""", reply_markup=keyboard)

        if call.data[0] == "z":
            print("maladec")
            with open(str(idik) + ".txt", "w+") as f:
                f.write("17200")
            foto = open('iran.jpg', 'rb')
            keyboard = types.InlineKeyboardMarkup(row_width=2)
            a1 = types.InlineKeyboardButton(text="1️⃣", callback_data="a1")
            a2 = types.InlineKeyboardButton(text="2️⃣", callback_data="a2")
            a3 = types.InlineKeyboardButton(text="3️⃣", callback_data="a3")
            a4 = types.InlineKeyboardButton(text="4️⃣", callback_data="x4")

            keyboard.add(a1, a2, a3, a4)
            bot.send_photo(call.message.chat.id, foto)
            bot.send_message(call.message.chat.id,"""✅Правильный ответ! Вы заработали 7200 тенге
❓ Страна на 9800 тенге
1️⃣  Египет
2️⃣  Малайзия
3️⃣  ОЭА
4️⃣  Иран""", reply_markup=keyboard)

        if call.data == "check":
            bot.send_message(call.message.chat.id,"""✅Вы получили бонус 270 тенге""")

        if call.data[0] == "z":
            print("maladec")
            with open(str(idik) + ".txt", "w+") as f:
                f.write("27000")
            foto = open('egypt.jpg', 'rb')
            keyboard = types.InlineKeyboardMarkup(row_width=2)
            a1 = types.InlineKeyboardButton(text="1️⃣", callback_data="a1")
            a2 = types.InlineKeyboardButton(text="2️⃣", callback_data="a2")
            a3 = types.InlineKeyboardButton(text="3️⃣", callback_data="q3")
            a4 = types.InlineKeyboardButton(text="4️⃣", callback_data="a4")

            keyboard.add(a1, a2, a3, a4)
            bot.send_photo(call.message.chat.id, foto)
            bot.send_message(call.message.chat.id,"""✅Правильный ответ! Вы заработали 9800 тенге
❓ Страна на 12000 тенге
1️⃣  Малайзия
2️⃣  Италия
3️⃣  Египет
4️⃣  США""", reply_markup=keyboard)

        if call.data[0] == "q":
            print("maladec")
            with open(str(idik) + ".txt", "w+") as f:
                f.write("39000")
            bot.send_message(call.message.chat.id,"""🎉 Поздравляю, 🗽𝔄𝔯𝔪𝔪𝔪𝔪! Ты - Победитель!
Ты заработал 12000 рублей. Жми «Вывод» и получи деньги прямо на свою карту!""")


        if call.data[0] == "a" and attempts != 0:
            attempts = attempts - 1
            bot.send_message(call.message.chat.id,"""ℹ
Осталось попыток пройти игру на сегодня: {}""".format(attempts))

        if call.data[0] == "a" and attempts == 0:

            bot.send_message(call.message.chat.id,"""❌Вы выбрали неправильный вариант ответа, но...
😈Игра на этом не закончилась.

Приглашай своих друзей в игру и зарабатывай на этом деньги.
1 Пользователь = 600 тенге
🔽Вот твоя пригласительная ссылка: {}""".format("https://t.me/guesscountrykz_bot?start=" + str(idik)))


        if call.data == "userlist":
            bot.send_message(call.message.chat.id, """⬇️Пользователи\n""")
            for i in userlist:
                bot.send_message(call.message.chat.id, """@{}\n""".format(i))


        if call.data == "sending":
            bot.send_message(call.message.chat.id, """Введите сообщение рассылки...\n""")


        if call.data == "stats":
            for i in userlist:
                sum = sum + 1

            bot.send_message(call.message.chat.id,"""Количество пользователей - {}""".format(sum))    


        if call.data == "withdraw":

            bot.send_message(call.message.chat.id,"""Введите карту(16 цифр без пробелов)...""")
예제 #5
0
파일: b13.py 프로젝트: SayedSadat/SBot
def Texts(msg):
    if msg.text:
        if msg.text == "/start":
            if msg.chat.type == "private":
                if redis.sismember("T_Bot_Stats:Users",
                                   msg.from_user.id) != True:
                    redis.sadd("T_Bot_Stats:Users", msg.from_user.id)
            if redis.sismember("T_Bot_Stats:All", msg.chat.id) != True:
                redis.sadd("T_Bot_Stats:All", msg.chat.id)
            Text = (redis.hget("T_Bot", "WelCome_Message") or "Hi")
            send(msg.chat.id, Text)

        if msg.chat.id in admins:
            if msg.text == "/panel":
                Button = types.ReplyKeyboardMarkup(resize_keyboard=True)
                Button.add(types.KeyboardButton("آمار"),
                           types.KeyboardButton("پیغام همگانی"))
                Button.add(types.KeyboardButton("متن خوش آمد گویی"),
                           types.KeyboardButton("متن گروه جدید"))
                send(msg.chat.id, "پنل مدیریت : ", reply_markup=Button)
            if msg.text == "آمار":
                Users = int(redis.scard("T_Bot_Stats:Users"))
                Groups = int(redis.scard("T_Bot_Stats:Groups"))
                All = int(redis.scard("T_Bot_Stats:All"))
                send(
                    msg.chat.id,
                    "آمار دقیق ربات تا این لحظه :\n\nکاربران: {}\nگروه ها: {}\nهمه : {}\n\n{}"
                    .format(Users, Groups, All, BOTu))
            if msg.text == "پیغام همگانی":
                Button = types.ReplyKeyboardMarkup(resize_keyboard=True)
                Button.add(types.KeyboardButton("بنر جدید"),
                           types.KeyboardButton("بنر آماده"))
                Button.add(types.KeyboardButton("بازگشت"))
                z = send(msg.chat.id, "انتخاب کنید : ", reply_markup=Button)
                bot.register_next_step_handler(z, BroadCast)
            if msg.text == "متن خوش آمد گویی":
                WelCome = (redis.hget("T_Bot", "WelCome_Message")
                           or "`تنظیم نشده`")
                Button = types.ReplyKeyboardMarkup(resize_keyboard=True)
                Button.add(types.KeyboardButton("تعویض متن"),
                           types.KeyboardButton("بازگشت"))
                z = send(
                    msg.chat.id,
                    "متن فعلی خوش آمدگویی : \n----------------\n{}\n----------------\nبرای تعویض متن از دکمه زیر استفاده نمایید"
                    .format(WelCome),
                    parse_mode="markdown",
                    reply_markup=Button)
                bot.register_next_step_handler(z, Set_Welcome)
            if msg.text == "/fwdall":
                q = msg.reply_to_message.message_id
                for i in redis.smembers("T_Bot_Stats:All"):
                    try:
                        bot.forward_message(i, msg.chat.id, q)
                    except:
                        pass
                Button = types.ReplyKeyboardMarkup(resize_keyboard=True)
                Button.add(types.KeyboardButton("آمار"),
                           types.KeyboardButton("پیغام همگانی"))
                Button.add(types.KeyboardButton("متن خوش آمد گویی"),
                           types.KeyboardButton("متن گروه جدید"))
                send(msg.chat.id, "ارسال شد!", reply_markup=Button)
            if msg.text == "بازگشت":
                Button = types.ReplyKeyboardMarkup(resize_keyboard=True)
                Button.add(types.KeyboardButton("آمار"),
                           types.KeyboardButton("پیغام همگانی"))
                Button.add(types.KeyboardButton("متن خوش آمد گویی"),
                           types.KeyboardButton("متن گروه جدید"))
                send(msg.chat.id, "منوی اصلی :", reply_markup=Button)
            if msg.reply_to_message:
                q = msg.reply_to_message.message_id
예제 #6
0
파일: app.py 프로젝트: Clusiv/alphabet
import telebot
from telebot import types
import os
import random 
import time

bot = telebot.TeleBot("")

if not os.path.exists('voice/'):
    os.makedirs('voice/')

markup = types.ReplyKeyboardMarkup(row_width=1)
itembtn1 = types.KeyboardButton('👨🏼‍💻 Начать обучение')
itembtn2 = types.KeyboardButton('👨🏾‍🏫 Начать изучение')
markup.add(itembtn1, itembtn2)

stopmarkup = types.ReplyKeyboardMarkup(row_width=1)
stopbtn = types.KeyboardButton('🛑 Stop')
stopmarkup.add(stopbtn)

clientsWord = {}
clientsStopStatus = {}

# TODO: Найти более красивые картинки не больше 50КБ каждая.
# TODO: Добавить функционал сказок.
# TODO: Выбрать огласовку чужую или записать свой голос сказки.

imageList = ['а.jpg','б.jpg','в.jpg','г.jpg','д.jpg','е.jpg','ё.jpg','ж.jpg','з.jpg','и.jpg','й.jpg','к.jpg','л.jpg','м.jpg','н.jpg','о.jpg','п.jpg','р.jpg','с.jpg','т.jpg','у.jpg','ф.jpg','х.jpg','ц.jpg','ч.jpg', 'ш.jpg' , 'щ.jpg', 'ъ.jpg','ы.jpg','ь.jpg','э.jpg','ю.jpg','я.jpg']
voiceList = ['а.ogg','б.ogg','в.ogg','г.ogg','д.ogg','е.ogg','ё.ogg','ж.ogg','з.ogg','и.ogg','й.ogg','к.ogg','л.ogg','м.ogg','н.ogg','о.ogg','п.ogg','р.ogg','с.ogg','т.ogg','у.ogg','ф.ogg','х.ogg','ц.ogg','ч.ogg','ш.ogg','щ.ogg','ъ.ogg','ы.ogg','ь.ogg','э.ogg','ю.ogg','я.ogg']
alphabet = ['а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я']
# current_number = 30
예제 #7
0
파일: tg.py 프로젝트: kirra7433/FMITBot
            message.chat.id,
            "Тебя приветствует поисковый бот 'Бздынь-библиотеки', это первый бот который специализируется только на книгах из мира Программирование! А вот тут наш канал @bzd_channel и чат @book_it :-)"
        )
        di[message.chat.id] = 0
        if sendMainMenu(message.chat.id):
            diDosProtect[message.chat.id] = True
            return
    else:
        return


####Markup-ы менюшек, дабы не пересоздавать каждый раз
#Главное меню
markupMainMenu = types.ReplyKeyboardMarkup()
markupMainMenu.resize_keyboard = True
itemAuthorMainMenu = types.KeyboardButton("Автор")
itemNameMainMenu = types.KeyboardButton("Название")
itemTagsMainMenu = types.KeyboardButton("Тэг")
itemAgeMainMenu = types.KeyboardButton("Год")
markupMainMenu.row(itemAuthorMainMenu, itemNameMainMenu)
markupMainMenu.row(itemTagsMainMenu, itemAgeMainMenu)
#Кнопка выхода в главное меню
markupReplyMenu = types.ReplyKeyboardMarkup()
markupReplyMenu.resize_keyboard = True
itemReplyMenu = types.KeyboardButton("🏠 Главное меню 🏠")
markupReplyMenu.row(itemReplyMenu)

##########


@bot.message_handler(content_types=['text'])
예제 #8
0
REASONS = []
REASONS.append('Посещение суда')
REASONS.append('Доставка несовершеннолетних в (из) образовательные организации')
REASONS.append('Посещение медицинской или ветеринарной организации')
REASONS.append('Участие в похоронах')
REASONS.append('Восстановление паспорта')
REASONS.append('Выезд в загородный дом или из него')
REASONS.append('Посещение кредитных организаций и почтовых отделений')
REASONS.append('Доставка лекарств, продуктов питания и предметов первой необходимости')
REASONS.append('Изменение места проживания')


reason_markup = types.ReplyKeyboardMarkup(row_width=2)
for reason in REASONS:
	itembtn = types.KeyboardButton(reason)
	reason_markup.add(itembtn)
	
contact_request_markup = types.ReplyKeyboardMarkup(one_time_keyboard=True)
button = types.KeyboardButton(text='Предоставить номер телефона',request_contact=True)
contact_request_markup.add(button)
	

conf=configparser.ConfigParser()
conf.read("bot.cfg")


DEBUG="true" == get_param("main", "DEBUG")


예제 #9
0
#Главное меню
admin = telebot.types.ReplyKeyboardMarkup(one_time_keyboard=True,
                                          resize_keyboard=True)
admin.row('Статистика', '/static')
admin.row('Команды', '❌Обратно')
#Барбер меню
barber = telebot.types.ReplyKeyboardMarkup(one_time_keyboard=True,
                                           resize_keyboard=True)
barber.row('Тигран')
barber.row('Алексей')
barber.row('Антон')
barber.row('Гаянэ')
# Сервис меню 1
service1 = types.ReplyKeyboardMarkup(one_time_keyboard=True,
                                     resize_keyboard=True)
itembtn1 = types.KeyboardButton('Мужская стрижка')
itembtn2 = types.KeyboardButton('Стрижка ножницами')
itembtn3 = types.KeyboardButton('Детская стрижка')
itembtn4 = types.KeyboardButton('Отец+Сын')
itembtn5 = types.KeyboardButton('Мужская стрижка+бритье')
itembtn55 = types.KeyboardButton('Стрижка машинкой')
itembtn6 = types.KeyboardButton('Окантовка')
itembtn7 = types.KeyboardButton('Ничего')
service1.add(itembtn1, itembtn2, itembtn3, itembtn4, itembtn5, itembtn55,
             itembtn6, itembtn7)
# Сервис меню 2
service2 = types.ReplyKeyboardMarkup(one_time_keyboard=True,
                                     resize_keyboard=True)
itembtn8 = types.KeyboardButton('Моделирование бороды')
itembtn9 = types.KeyboardButton('Стрижка бороды и усов')
itembtn100 = types.KeyboardButton('Королевское бритьё')
예제 #10
0
from selenium import webdriver
import telebot
from telebot import types
from telebot import TeleBot
import pdfkit
import time
bot = telebot.TeleBot('')

yes = types.KeyboardButton('Да')
no = types.KeyboardButton('Нет')

role1 = types.KeyboardButton('Абитуриент')
role2 = types.KeyboardButton('Бакалавр')
role3 = types.KeyboardButton('Магистрант')

abiturient1 = types.KeyboardButton('Направления подготовки')
abiturient2 = types.KeyboardButton(
    'Подробно о направлениях подготовки (Баллы)')
abiturient3 = types.KeyboardButton('Список поданных заявлений')
abiturient4 = types.KeyboardButton('Информация для поступивших (Общежитие)')
abiturient5 = types.KeyboardButton('Учебные планы')
abiturient6 = types.KeyboardButton('До вузовская подготовка')
abiturient7 = types.KeyboardButton('Информация об ИВМиИТ')
abiturient8 = types.KeyboardButton('Назад')

bacalavr1 = types.KeyboardButton('Доступное Расписание')
bacalavr2 = types.KeyboardButton('Назад')

magistr1 = types.KeyboardButton('Темы научных исследований последних лет')
magistr2 = types.KeyboardButton('Назад')
예제 #11
0
import random
import replacement
import telebot
from telebot import types
from telebot.types import Message

TOKEN = ""

START_MESSAGE = "Привет, я представляю интересы Дмитрия!\n Что-бы узнать список команд, введи /help."
HELP_MESSAGE = "Ну короче кто-то слишком ленивый что бы это заполнять!"
ERROR_MESSAGE = "Что-то пошло не так... Попробуй по другому"
LANG_MESSAGE = "Choose your language/Выберите свой язык/Виберіть свою мову:"
START_MESSAGE = "Ещё не придумал"

lang_quest = types.ReplyKeyboardMarkup(row_width=2)
itembtn1 = types.KeyboardButton('ua')
itembtn2 = types.KeyboardButton('ru')
itembtn3 = types.KeyboardButton('en')
lang_quest.add(itembtn1, itembtn2, itembtn3)

bot = telebot.TeleBot(TOKEN)


@bot.message_handler(commands=['start'])
def send_welcome(message: Message):
    bot.reply_to(message, START_MESSAGE)  #, reply_markup=lang_quest)


@bot.edited_message_handler(commands=['start'])
def send_welcome_edited(message: Message):
    bot.send_message(message.chat.id, START_MESSAGE)  #reply_markup=lang_quest)
예제 #12
0
파일: poeBOT.py 프로젝트: sikera4/poebot
def handle_start_help(message):
      keyb = types.ReplyKeyboardMarkup(resize_keyboard = True)
      item = types.KeyboardButton('Хочу гороскоп!')
      keyb.add(item)
      bot.send_message(message.from_user.id, text = "Напиши привет или нажми на кнопку Хочу гороскоп!", reply_markup = keyb)
예제 #13
0
import sqlite3
import time

bot = telebot.TeleBot(config.token)

user_dict = {}


class User:
    def __init__(self, name):
        self.name = name
        self.fname = None


bosh_menyu = types.ReplyKeyboardMarkup(True, row_width=2)
menyu_1 = types.KeyboardButton('Mening tovuqlarim 🐓')
menyu_2 = types.KeyboardButton('Kanalga a`zo bo`lish ✍️')
menyu_3 = types.KeyboardButton('Bozor 🚚')
menyu_4 = types.KeyboardButton('Balans 💵')
menyu_5 = types.KeyboardButton('Shaxsiy kabinet 👨‍⚕️')
bosh_menyu.add(menyu_1, menyu_2, menyu_3, menyu_4, menyu_5)

reg_un = types.InlineKeyboardMarkup()
menyu_11 = types.InlineKeyboardButton(text="Ro`yhatdan o`tish 👨‍⚕️",
                                      callback_data="121212")
reg_un.add(menyu_11)

balans_un = types.InlineKeyboardMarkup(True)
menyu_11 = types.InlineKeyboardButton(text="Pulni chiqarish",
                                      callback_data="pulchiq")
menyu_12 = types.InlineKeyboardButton(text="Hisobni to`ldirish",
예제 #14
0
def handle_text(m):

    if m.text == 'назад':
        start(m)
    if m.text == 'Інформація про коледж':
        bot.send_message(m.chat.id, 'https://tk.lntu.edu.ua/navchalnij-zaklad')

    elif m.text == 'Розклад занять':
        keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True)
        keyboard.add(*[types.KeyboardButton(name)for name in ['11-КІ','12-КІ', '11-АТ',
                                                              '12-АТ', '11-ЕТ', '11-МД',
                                                              '11-Д', '21-АТ', '22-АТ',
                                                              '21-Д', '22-ТЛП', '21-ЕТ',
                                                              '21-МД', '21-КІ', '22-КІ',
                                                              '31-ЕПС','31-ОРА', '31-ОРВ',
                                                              '31-Д', '31-ОРЕ', '32-ТЛП',
                                                              '31-КСМ', '41-КСМ','42-КСМ',
                                                               '41-ОРА', '42-ОРА', '41-Д',
                                                              '41-ЕПС', 'назад' ]])
        bot.send_message(m.chat.id,'Виберіть групу', reply_markup=keyboard)

    elif m.text == 'Розклад дзвінків':
        dzvinki = ('1. 8.30-9.50'+"\n"+'2. 10.00-11.20'+'\n'+'Обід. 11.20-12.10'+'\n'+'3. 12.10-13.30'+'\n'+'4. 13.40-15.00')
        bot.send_message(m.chat.id, dzvinki)

    elif m.text == 'Рейтинг студентів':
        bot.send_message(m.chat.id, "http://tk.lntu.edu.ua/wp-content/uploads/2018/01/reyting-uch.pdf")

    elif m.text == '11-КІ':

        OutputRozklad(m.chat.id, 'B6', 'E33')

    elif m.text == '12-КІ':

        OutputRozklad(m.chat.id, 'F6', 'I33')

    elif m.text == '11-АТ':
        OutputRozklad(m.chat.id, "J6", "M33")



    elif m.text == '12-АТ':
        OutputRozklad(m.chat.id, "B41", "E69")

    elif m.text == '11-ЕТ':
        OutputRozklad(m.chat.id, "F41", "I69")

    elif m.text == '11-МД':
        OutputRozklad(m.chat.id, "J41", "M69")



    elif m.text == '11-Д':
        OutputRozklad(m.chat.id, "B76", "E105")

    elif m.text == '21-АТ':
        OutputRozklad(m.chat.id, "F76", "I105")

    elif m.text == '22-АТ':
        OutputRozklad(m.chat.id, "J76", "M105")



    elif m.text == '21-Д':
        OutputRozklad(m.chat.id, "B113", "E140")

    elif m.text == '22-ТЛП':
        OutputRozklad(m.chat.id, "F113", "I140")

    elif m.text == '21-ЕТ':
        OutputRozklad(m.chat.id, "J113", "M140")



    elif m.text == '21-МД':
        OutputRozklad(m.chat.id, "B147", "E175")

    elif m.text == '21-КІ':
        OutputRozklad(m.chat.id, "F147", "I175")

    elif m.text == '22-КІ':
        OutputRozklad(m.chat.id, "J147", "M175")



    elif m.text == '31-ЕПС':
        OutputRozklad(m.chat.id, "B185", "E210")

    elif m.text == '31-ОРА':
        OutputRozklad(m.chat.id, "F185", "I210")

    elif m.text == '31-ОРВ':
        OutputRozklad(m.chat.id, "J185", "M210")



    elif m.text == '31-Д':
        OutputRozklad(m.chat.id, "B220", "E247")

    elif m.text == '31-ОРЕ':
        OutputRozklad(m.chat.id, "F220", "I247")

    elif m.text == '2-ТЛП':
        OutputRozklad(m.chat.id, "J220", "M247")



    elif m.text == '31-КСМ':
        OutputRozklad(m.chat.id, "B251", "E275")

    elif m.text == '41-КСМ':
        OutputRozklad(m.chat.id, "F251", "I275")

    elif m.text == '42-КСМ':
        OutputRozklad(m.chat.id, "J251", "M275")


    elif m.text == '41-ОРА':
        OutputRozklad(m.chat.id, "B282", "E303")

    elif m.text == '42-ОРА':
        OutputRozklad(m.chat.id, "F282", "I303")

    elif m.text == '41-Д':
        OutputRozklad(m.chat.id, "J282", "M303")



    elif m.text == '41-ЕПС':
        OutputRozklad(m.chat.id, "B311", "E335")
예제 #15
0
DACHA = {
    'title': 'ДАЧА У ОЛЕГА',
    'lonm': 104.244784,
    'latm': 52.399846,
    'address': 'г. Иркутск, СНТ "Веселое", ул. Земляничная, д.228'
}

USERS = {1: 1}
poset = []
bot = telebot.TeleBot('969319994:AAETSx5cNFDCwJy7Rz7ef4R5Ip137da2zTk')

markup_menu = types.ReplyKeyboardMarkup(resize_keyboard=True,
                                        row_width=1,
                                        one_time_keyboard=True)
btn_address = types.KeyboardButton('Узнать адрес дачи', request_location=True)
btn_payment = types.KeyboardButton('Способы оплаты и цена')
btn_see_pay = types.KeyboardButton('Посмотреть, кто уже тут')
markup_menu.add(btn_address, btn_payment, btn_see_pay)

markup_menu_back = types.ReplyKeyboardMarkup(resize_keyboard=True,
                                             row_width=1,
                                             one_time_keyboard=True)
btn_menu_back = types.KeyboardButton('<- Назад')
markup_menu_back.add(btn_menu_back)

markup_inline_payment = types.InlineKeyboardMarkup(row_width=1)
btn_in_cash = types.InlineKeyboardButton('Наличные при встрече',
                                         callback_data='cash')
btn_in_card = types.InlineKeyboardButton('Перевод на карту Сбербанка',
                                         callback_data='card')
예제 #16
0
bot = telebot.TeleBot('1531646920:AAGC30IxLcb1S91rk3Sgw8HISwf9f-AJ5LE')
@bot.message_handler(commands=['start'])
def start_message(message):
    bot.send_message(message.chat.id,"тут типо меню для шаблонов:", reply_markup=markup)
from telebot import types

# Using the ReplyKeyboardMarkup class
# It's constructor can take the following optional arguments:
# - resize_keyboard: True/False (default False)
# - one_time_keyboard: True/False (default False)
# - selective: True/False (default False)
# - row_width: integer (default 3)
# row_width is used in combination with the add() function.
# It defines how many buttons are fit on each row before continuing on the next row.
markup = types.ReplyKeyboardMarkup(row_width=2)
itembtn1 = types.KeyboardButton('url1')
itembtn2 = types.KeyboardButton('url1')
itembtn3 = types.KeyboardButton('url1')
itembtn4 = types.KeyboardButton('url1')
itembtn5 = types.KeyboardButton('url1')
markup.add(itembtn1, itembtn2, itembtn3, itembtn4, itembtn5)


@bot.message_handler(content_types=['text'])
def send_text(message):
    if message.text.lower() == 'привет':
        bot.send_message(message.chat.id, 'Привет, мой создатель')
        logging.info(message.text)
    elif message.text.lower() == 'пока':
        bot.send_message(message.chat.id, 'Прощай, создатель')
        logging.info(message.text)
예제 #17
0
import telebot
import cfg
from telebot import types
from string import Template

bot = telebot.TeleBot(cfg.token)

user_dict = {}

main_button = types.ReplyKeyboardMarkup(resize_keyboard=True)
test = types.KeyboardButton('/test')
test2 = types.KeyboardButton('/test2')
test3 = types.KeyboardButton('/test3')
main_button.add(test)
main_button.add(test2, test3)


class User:
    def __init__(self, fullname):
        self.fullname = fullname

        keys = ['phone', 'q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q7', 'q8']

        for key in keys:
            self.key = None


class User2:
    def __init__(self, fullname):
        self.fullname = fullname
예제 #18
0
def handleCommand(message):

    myUserState = myDataHandler.getUserState(message.from_user.id)
    myUserToken = myDataHandler.getToken(message.from_user.id)
    myUserTreaty = myDataHandler.getTreatyState(message.from_user.id)

    if(myUserState != -1 and myUserToken == -1):
        userState = myDataHandler.getUserState(message.from_user.id)

        if (message.text == API.CoreData.treatyText):
            bot.reply_to(message, "ابتدا باید وارد شوید")
            if(userState == 0):
                bot.send_message(message.chat.id, "لطفا نام کاربری خود را وارد کنید")
            elif(userState == 1):
                bot.send_message(message.chat.id, "لطفا رمز خود را وارد نمایید")

        elif (message.text == API.CoreData.packageText):
            bot.reply_to(message, "ابتدا باید وارد شوید")
            if (userState == 0):
                bot.send_message(message.chat.id, "لطفا نام کاربری خود را وارد کنید")
            elif (userState == 1):
                bot.send_message(message.chat.id, "لطفا رمز خود را وارد نمایید")

        elif(userState == 0):
            myDataHandler.setStateforUser(message.from_user.id, 1, message.text)
            messageText = myReqHandler.messageCreator.signIn(1)
            bot.send_message(message.chat.id, messageText)

        elif(userState == 1):
            myDataHandler.setStateforUser(message.from_user.id, 2, "", message.text)
            bot.send_message(message.chat.id, "لطفا صبر کنید" + u'\U000023F3')
            userPass = myDataHandler.getUserUsernamePass(message.from_user.id)
            logState = myReqHandler.signIn(userPass[0], userPass[1])
            if(not logState):
                #messageText = "نام کاربری یا رمز اشتباه است دوباره تلاش کنید" + '\n\n'
                #bot.send_message(message.chat.id, messageText)
                #messageText = myReqHandler.messageCreator.signIn(0)
                messageText = myReqHandler.messageCreator.badLogin()
                myDataHandler.setZState(message.from_user.id)
                bot.send_message(message.chat.id, messageText)
            else:
                #bot.send_message(message.chat.id,"خوش آمدید")
                myDataHandler.insertUser(str(message.from_user.id), logState)
                myDataHandler.removeFromUserSates(message.from_user.id)
                start(message)

    elif(myUserState == -1 and myUserToken == -1):
        messageText = "ابتدا باید وارد شوید. نام کاربری را وارد کنید"
        myDataHandler.setStateforUser(message.from_user.id, 0)
        bot.send_message(message.chat.id, messageText)

    elif(myUserToken != -1):

        if(myUserTreaty == -1):

            if(message.text == API.CoreData.treatyText):
                getTreaties(message, myUserToken)
                myDataHandler.setTreaty(message.from_user.id, 0)
                #treatyRemoveMarkup = types.ReplyKeyboardRemove()

                #bot.send_message(message.from_user.id, "لطفا شماره ی قرارداد خود را وارد نمایید", reply_markup=treatyRemoveMarkup)
                backMarkup = types.ReplyKeyboardMarkup()
                returnBtn = types.KeyboardButton(API.CoreData.returnText)
                backMarkup.row(returnBtn)
                backMarkup.resize_keyboard = True
                toSendText = u'\U0001F58C' + "لطفا شناسه ی قرارداد خود را وارد نمایید"
                bot.send_message(message.chat.id, toSendText, reply_markup= backMarkup)

            elif(message.text == API.CoreData.packageText):
                getPackages(message, myUserToken)

            elif(message.text == API.CoreData.pickupText):
                getPickups(message, myUserToken)

            elif(message.text == API.CoreData.contactText):
                contactUs(message, myUserToken)

            elif(message.text == API.CoreData.logoutText):
                logout(message)

        else:

            if(message.text == API.CoreData.treatyText or
               message.text == API.CoreData.packageText or
               message.text == API.CoreData.pickupText or
               message.text == API.CoreData.contactText):
                myDataHandler.removeFromTreaty(message.from_user.id)
                handleCommand(message)

            if(myUserTreaty == 0):
                if(message.text == API.CoreData.returnText):
                    myDataHandler.removeFromTreaty(message.from_user.id)
                    serviceMarkup = types.ReplyKeyboardMarkup(row_width=2, selective=False)
                    treatyBtn = types.KeyboardButton(API.CoreData.treatyText)
                    packageBtn = types.KeyboardButton(API.CoreData.packageText)
                    pickupBtn = types.KeyboardButton(API.CoreData.pickupText)
                    contactBtn = types.KeyboardButton(API.CoreData.contactText)
                    logoutBtn = types.KeyboardButton(API.CoreData.logoutText)
                    serviceMarkup.row(treatyBtn, packageBtn)
                    serviceMarkup.row(pickupBtn)
                    serviceMarkup.row(logoutBtn, contactBtn)
                    serviceMarkup.resize_keyboard = True
                    toSendText = u'\U0001F58C' + "لطفا سرویس مورد نظر خود را انتخاب نمایید "
                    bot.send_message(message.chat.id, toSendText, reply_markup=serviceMarkup)

                else:
                    myDataHandler.setTreaty(message.from_user.id, 1, message.text)
                    treatyMarkup = types.ReplyKeyboardMarkup()
                    hotelBtn = types.KeyboardButton(API.CoreData.hotelText)
                    ticketBtn = types.KeyboardButton(API.CoreData.ticketText)
                    recieptBtn = types.KeyboardButton(API.CoreData.receiptText)
                    returnBtn = types.KeyboardButton(API.CoreData.returnText)
                    treatyMarkup.row(hotelBtn, ticketBtn)
                    treatyMarkup.row(recieptBtn)
                    treatyMarkup.row(returnBtn)
                    treatyMarkup.resize_keyboard = True
                    toSendText = u'\U0001F58C' + "لطفا سرویس قرارداد خود را انتخاب نمایید "
                    bot.send_message(message.from_user.id, toSendText,reply_markup= treatyMarkup)

            elif(myUserTreaty == 1):

                if(message.text == API.CoreData.returnText):
                    myDataHandler.removeFromTreaty(message.from_user.id)
                    serviceMarkup = types.ReplyKeyboardMarkup(row_width=2, selective=False)
                    treatyBtn = types.KeyboardButton(API.CoreData.treatyText)
                    packageBtn = types.KeyboardButton(API.CoreData.packageText)
                    pickupBtn = types.KeyboardButton(API.CoreData.pickupText)
                    contactBtn = types.KeyboardButton(API.CoreData.contactText)
                    logoutBtn = types.KeyboardButton(API.CoreData.logoutText)
                    serviceMarkup.row(treatyBtn, packageBtn)
                    serviceMarkup.row(pickupBtn)
                    serviceMarkup.row(logoutBtn, contactBtn)
                    serviceMarkup.resize_keyboard = True
                    toSendText = u'\U0001F58C' + "لطفا سرویس مورد نظر خود را انتخاب نمایید "
                    bot.send_message(message.chat.id, toSendText, reply_markup=serviceMarkup)
                    #bot.send_message(message.chat.id, "سرویس خود را انتخاب کنید", reply_markup=serviceMarkup)

                elif(message.text == API.CoreData.hotelText):
                    treatyNum = myDataHandler.getTreatyMessage(message.from_user.id)
                    myDataHandler.generateHotelPdf(myReqHandler.getHotel(myUserToken, treatyNum), treatyNum)
                    bot.send_document(message.chat.id, data= open(
                        'API/Files/' + str(treatyNum) + '-hotel.pdf', 'rb'
                    ))
                    myDataHandler.removeHotelPdf(treatyNum)

                elif(message.text == API.CoreData.ticketText):
                    treatyNum = myDataHandler.getTreatyMessage(message.from_user.id)
                    myDataHandler.generateTicketPdf(myReqHandler.getTicket(myUserToken, treatyNum), treatyNum)
                    bot.send_document(message.chat.id, data= open(
                        'API/Files/' + str(treatyNum) + '-ticket.pdf', 'rb'
                    ))
                    myDataHandler.removeTicketPdf(treatyNum)

                elif(message.text == API.CoreData.receiptText):
                    treatyNum = myDataHandler.getTreatyMessage(message.from_user.id)
                    myDataHandler.generateReceiptPdf(myReqHandler.getReceipt(myUserToken, treatyNum), treatyNum)
                    bot.send_document(message.chat.id, data=open(
                        'API/Files/' + str(treatyNum) + '-receipt.pdf', 'rb'
                    ))
                    myDataHandler.removeReceiptPdf(treatyNum)
예제 #19
0
lvlpic3 = db.LVLPIC3
lvltxt4 = db.LVLTXT4
lvlpic4 = db.LVLPIC4
lvlpic5 = db.LVLPIC5
fngpic = db.FNGPIC

#кнопки
markup = types.ReplyKeyboardMarkup(
    resize_keyboard=True)  #сгенирировали поле для клавы
markup0 = types.ReplyKeyboardMarkup(resize_keyboard=True)
markup1 = types.ReplyKeyboardMarkup(resize_keyboard=True)
markup2 = types.ReplyKeyboardMarkup(resize_keyboard=True)
markup3 = types.ReplyKeyboardMarkup(resize_keyboard=True)
markup4 = types.ReplyKeyboardMarkup(resize_keyboard=True)

item1 = types.KeyboardButton("Выполнили")  #какие кнопки туда добавляем
item2 = types.KeyboardButton("Пропустить")
item3 = types.KeyboardButton("Следующий уровень")
item4 = types.KeyboardButton("Новая игра")
item5 = types.KeyboardButton("Продолжить")
item6 = types.KeyboardButton("Поблагодарить")
item7 = types.KeyboardButton("Вопросы и пожелания")

markup.add(item1, item2, item4, item7)
markup0.add(item1, item2, item3, item4, item7)
markup1.add(item4)
markup2.add(item5, item6)
markup3.add(item4, item6)
markup4.add(item4, item5)

bot = telebot.TeleBot(cfg.TOKEN)  #присваиваем значение конфига
예제 #20
0
def phone():
    kb = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
    kb.add(types.KeyboardButton(text='Отправить телефон', request_contact=True),
           types.KeyboardButton(text='Отмена'))
    return kb
예제 #21
0
def send_commands(message):
    bot.reply_to(message,
                 text='use /time to know time right now'
                 'use /data to know current data'
                 'use /choose if you want to use buttons')


@bot.message_handler(commands=['time'])
def send_welcome(message):
    bot.reply_to(message, datetime.datetime.now().time())


@bot.message_handler(commands=['date'])
def send_welcome(message):
    bot.reply_to(message, datetime.date.today())


markup = types.ReplyKeyboardMarkup(row_width=0.5)
itembtn1 = types.KeyboardButton('/time')
itembtn2 = types.KeyboardButton('/date')

markup.add(itembtn1, itembtn2)


@bot.message_handler(commands='choose')
def choosebtn(message):
    bot.reply_to(message, "Choose one letter:", reply_markup=markup)


bot.polling(none_stop=True)
예제 #22
0
def cancel():
    kb = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
    kb.add(types.KeyboardButton(text='Отмена'))
    return kb
예제 #23
0
def userMoveCheck(cur,game,answer):
	res = {}
	add = {"type":"","val":""}
	mes = []
	but = []
	cur.execute("select d.ANSWER "
					+"from T_QUEST_DICT d "
					+"WHERE d.ID="+str(game['THIS_QUEST_ID'])
				+" union ALL "
				+"select v.VAL ANSWER "
					+"from T_QUEST_DICT_VAR v "
					+"WHERE v.QUEST_ID="+str(game['THIS_QUEST_ID']))
	quest = cur.fetchall()
	for ans in quest:
		x = re.sub("[^A-ZА-ЯЇІЄ0-9]","",str(ans['ANSWER']).upper())
		y = re.sub("[^A-ZА-ЯЇІЄ0-9]","",answer.upper())
		if SequenceMatcher(None, x, y).ratio()>0.85:
			s=1
		elif x.find(y)>=0 and len(y)>5:
			s=1
		elif y.find(x)>=0 and len(x)>5:
			s=1
		else:
			s=0
		if s==1:
			rightAnswer = ans['ANSWER']
			break
	cur.execute("SELECT NVL(MAX(ID),0)+1 ROW_ID "
				+"FROM T_QUEST_BEEN")
	rowId = cur.fetchall()[0]['ROW_ID']
	if s==0:
		mes.append("Ответ '"+answer+"' не принят.")
		cur.execute("INSERT INTO T_QUEST_BEEN(ID,GAME_ID,QUEST_ID,ANSWER) VALUES("
						+str(rowId)+","
						+str(game['ID'])+","
						+str(game['THIS_QUEST_ID'])+","
						+"'"+str(answer)+"')")
		cur.execute("UPDATE T_QUEST_MAIN "
						+"SET LAST_ANSWER_ID='"+str(rowId)+"', "
						+"STATUS_CD='PreAnswer' "
						+"WHERE ID="+str(game['ID']))
		if game['TYPE_CD']=="С вариантами ответов":
			arr = str(game['QUESTION']).split('|||')[1].split(';')
			shuffle(arr)
			for ar in arr:
				item = types.KeyboardButton(text=str(ar))
				but.append(item.to_dic())
	else:
		mes.append("Ответ '"+rightAnswer+"' принят.")
		cur.execute("INSERT INTO T_QUEST_BEEN(ID,GAME_ID,QUEST_ID,ANSWER,RESULT) VALUES("
						+str(rowId)+","
						+str(game['ID'])+","
						+str(game['THIS_QUEST_ID'])+","
						+"'"+str(answer)+"','Correct')")
		cur.execute("UPDATE T_QUEST_MAIN "
					+"SET LAST_ANSWER_ID='"+str(rowId)+"', "
					+"STATUS_CD='PostAnswer' "
					+"WHERE ID="+str(game['ID']))
	res['messages']=mes
	res['add']=add
	res['but']=but
	return (res)
예제 #24
0
def StartCommand(message):
    db.NewUser(message.from_user.id, message.from_user.language_code)
    keyboard = types.ReplyKeyboardMarkup(row_width = 1, resize_keyboard = True, one_time_keyboard = True)
    keyboard.add(types.KeyboardButton(text = "📍Геопозиция", request_location = True))
    bot.send_message(message.chat.id, loc.start[db.Language(message.chat.id)], reply_markup = keyboard)
예제 #25
0
파일: b13.py 프로젝트: SayedSadat/SBot
def Set_Welcome(msg):
    if msg.text == "تعویض متن":
        Button = types.ReplyKeyboardMarkup(resize_keyboard=True)
        Button.add(types.KeyboardButton("بازگشت"))
        z = send(msg.chat.id, "متن جدید را ارسال کنید : ", reply_markup=Button)
        bot.register_next_step_handler(z, Set_Welcome_Text)
예제 #26
0
import telebot
from telebot import types
from Bomber import bombing

bot = telebot.TeleBot("923492737:AAHA-LNgf4np0kz4Iws6vteziocqg9fa0ns")

keyboard = types.ReplyKeyboardMarkup(row_width=2, resize_keyboard=True)
keyStartBomb = types.KeyboardButton(text="💣Начать бомбежку")
keyHelp = types.KeyboardButton(text="🆘Помощь")
keyboard.add(keyStartBomb, keyHelp)

keyboardTime = types.ReplyKeyboardMarkup(row_width=5, resize_keyboard=True)
key1time = types.KeyboardButton(text="1")
key5time = types.KeyboardButton(text="5")
key10time = types.KeyboardButton(text="10")
key15time = types.KeyboardButton(text="15")
key20time = types.KeyboardButton(text="20")
key30time = types.KeyboardButton(text="30")

keyboardTime.add(key1time, key5time, key10time, key15time, key20time,
                 key30time)


@bot.message_handler(commands=["start"])
def start_messaging(message):
    bot.send_message(message.chat.id, message.text, reply_markup=keyboard)


@bot.message_handler(content_types=["text"])
def get_message(message):
    if message.text[1::] == "Начать бомбежку":
예제 #27
0
           'content-type' in cherrypy.request.headers and \
           cherrypy.request.headers['content-type'] == 'application/json':
            length = int(cherrypy.request.headers['content-length'])
            json_string = cherrypy.request.body.read(length).decode("utf-8")
            update = telebot.types.Update.de_json(json_string)
            bot.process_new_updates([update])
            return ''
        else:
            raise cherrypy.HTTPError(403)


bot = telebot.TeleBot(API_TOKEN)
engine = KrakenAlertBot()

markup = types.ReplyKeyboardMarkup(row_width=2, resize_keyboard=True)
add_btn = types.KeyboardButton('/add')
dell_btn = types.KeyboardButton('/dell')
all_btn = types.KeyboardButton('/all')
pairs_list_btn = types.KeyboardButton('/pairs')
help_btn = types.KeyboardButton('/help')
contact_btn = types.KeyboardButton('/contact_us')
markup.add(add_btn, dell_btn, all_btn, pairs_list_btn, help_btn, contact_btn)


@bot.message_handler(commands=['contact_us'])
def send_contact(message):
    bot.send_message(message.chat.id,
                     "If your want to make some proposals or you've "
                     "found a bug, please contact us @GalinaKoljadina",
                     reply_markup=markup)
예제 #28
0
 def button_type(self, text, **button):
     return types.KeyboardButton(text, **button)
예제 #29
0
        return tmp


def get_airdrop_users():
    connection = get_connection()
    with connection.cursor() as cursor:
        sql = "SELECT user_id FROM users WHERE address IS NOT NULL"
        cursor.execute(sql)
        tmp = []
        for user in cursor.fetchall():
            tmp.append(user["user_id"])
        return tmp


default_keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True)
default_keyboard.row(types.KeyboardButton("🚀 Join Airdrop"))

airdrop_keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True)
airdrop_keyboard.row(types.KeyboardButton("💼 View Wallet Address"))


def cancel_button():
    markup = InlineKeyboardMarkup()
    markup.add(
        InlineKeyboardButton("Cancel Operation", callback_data="cancel_input"))
    return markup


def update_wallet_address_button(message):
    connection = get_connection()
    with connection.cursor() as cursor:
예제 #30
0
def back_keyboard():
    markup = types.ReplyKeyboardMarkup(one_time_keyboard=False,
                                       resize_keyboard=True)
    btn1 = types.KeyboardButton('Назад')
    markup.add(btn1)
    return markup