Пример #1
0
    async def _new_document(self, _: Client, message: Message):
        devices = []

        if self._config.upnp_enabled:
            devices.extend(await UpnpDeviceFinder.find(self._config))

        if self._config.chromecast_enabled:
            # noinspection PyUnresolvedReferences
            devices.extend(await ChromecastDeviceFinder.find(self._config))

        if self._config.xbmc_enabled:
            devices.extend(await XbmcDeviceFinder.find(self._config))

        if self._config.vlc_enabled:
            devices.extend(await VlcDeviceFinder.find(self._config))

        if devices:
            try:
                filename = pyrogram_filename(message)
            except TypeError:
                filename = "NaN"

            self._state_machine.set_state(
                message, States.SELECT,
                SelectStateData(message.message_id, filename, devices.copy()))

            buttons = [[KeyboardButton(repr(device))] for device in devices]
            buttons.append([KeyboardButton(_CANCEL_BUTTON)])
            markup = ReplyKeyboardMarkup(buttons, one_time_keyboard=True)
            await message.reply("Select a device", reply_markup=markup)

        else:
            await message.reply("Supported devices not found in the network",
                                reply_markup=_REMOVE_KEYBOARD)
Пример #2
0
async def rate(_client: Client, callback: CallbackQuery):
    _, amount, tgo_id = callback.data.split('|')
    accept_rate(int(tgo_id), int(amount), callback.from_user.id)
    info = get_info(tgo_id)
    await callback.edit_message_text(
        f"Success!\n🌟Rates average: {info.stars_average} / 5")
    review = await _client.ask(
        callback.message.chat.id,
        "Want to write a review?",
        reply_markup=ReplyKeyboardMarkup(
            [[KeyboardButton('Yes'),
              KeyboardButton('No')]],
            resize_keyboard=True,
            one_time_keyboard=True))
    await review.delete()
    await review.request.delete()
    if str(review.text) == 'No':
        return await callback.message.reply("Thanks!",
                                            reply_markup=ReplyKeyboardRemove())
    elif str(review.text) == 'Yes':
        review = await _client.ask(callback.message.chat.id,
                                   "Write your review:",
                                   reply_markup=ReplyKeyboardRemove())
        await review.request.delete()
        await review.delete()
        await callback.message.reply("Thanks!")
        return await _client.send_message(
            info.owner, "Review from "
            f" [{callback.from_user.first_name}]"
            f"(tg://user?id={callback.from_user.id}) "
            f"about [this bot](tg://user?id={info.id})\n\n"
            f"{str(review.text)}")
    else:
        return await callback.message.reply("Stop zaccing me!")
Пример #3
0
async def open_panel(_client: Client, message: Message):
    await message.reply(
        "Select Option below", reply_markup=ReplyKeyboardMarkup([
            [KeyboardButton('Add new')],
            [KeyboardButton('My bots / channels / groups')]
        ], resize_keyboard=True, one_time_keyboard=True)
    )
Пример #4
0
def kb(rows = [], **kwargs):
    lines = []
    for row in rows:
        line = []
        for button in row:
            button_type = type(button)
            if button_type == str:
                button = KeyboardButton(button)
            elif button_type == dict:
                button = KeyboardButton(**button)
            
            line.append(button)
        lines.append(line)
    return ReplyKeyboardMarkup(keyboard=lines, **kwargs)
Пример #5
0
async def start(app: Client, message: Message):
    if message.from_user.id in USERS:
        await message.reply_text(plate("hello", USERS[message.from_user.id]))
    else:
        await message.reply_text(
            "Language? Sprache? Linguaggio?",
            reply_markup=ReplyKeyboardMarkup(
                [[
                    KeyboardButton(DE),
                    KeyboardButton(US),
                    KeyboardButton(IT),
                ]],
                resize_keyboard=True,
                one_time_keyboard=True,
            ),
        )
Пример #6
0
def row_reply_button_command(client, message):
    keyboard = ReplyKeyboard()
    keyboard.row(KeyboardButton('1', 'reply_keyboard#1'))
    keyboard.row(KeyboardButton('2', 'reply_keyboard#2'),
                 KeyboardButton('3', 'reply_keyboard#3'))
    keyboard.row(KeyboardButton('4', 'reply_keyboard#4'))
    keyboard.row(KeyboardButton('5', 'reply_keyboard#5'))
    message.reply_text(
        '<b>Add button row:</b>\n\n'
        "<code>keyboard = ReplyKeyboard()</code>\n"
        "<code>keyboard.row(KeyboardButton('1', 'reply_keyboard#1'))</code>\n"
        "<code>keyboard.row(</code>\n"
        "<code>    KeyboardButton('2', 'reply_keyboard#2'),</code>\n"
        "<code>    KeyboardButton('3', 'reply_keyboard#3')</code>\n"
        "<code>)</code>\n"
        "<code>keyboard.row(KeyboardButton('4', 'reply_keyboard#4'))</code>\n"
        "<code>keyboard.row(KeyboardButton('5', 'reply_keyboard#5'))</code>\n",
        reply_markup=keyboard)
Пример #7
0
def add_reply_button_command(client, message):
    keyboard = ReplyKeyboard(row_width=3)
    keyboard.add(
        KeyboardButton('1', 'reply_keyboard#1'),
        KeyboardButton('2', 'reply_keyboard#2'),
        KeyboardButton('3', 'reply_keyboard#3'),
        KeyboardButton('4', 'reply_keyboard#4'),
        KeyboardButton('5', 'reply_keyboard#5'),
    )
    message.reply_text(
        '<b>Add buttons:</b>\n\n'
        '<code>keyboard = ReplyKeyboard(row_width=3)</code>\n'
        '<code>keyboard.add(</code>\n'
        "<code>    KeyboardButton('1', 'reply_keyboard#1'),</code>\n"
        "<code>    KeyboardButton('2', 'reply_keyboard#2'),</code>\n"
        "<code>    KeyboardButton('3', 'reply_keyboard#3'),</code>\n"
        "<code>    KeyboardButton('4', 'reply_keyboard#4'),</code>\n"
        "<code>    KeyboardButton('5', 'reply_keyboard#5'),</code>\n"
        '<code>)</code>\n',
        reply_markup=keyboard)
Пример #8
0
async def start_handler(_client: Client, message):
    if hasattr(message, 'reply'):
        callback = message.reply
    else:
        await message.message.delete()
        callback = message.message.reply
    await callback(
        f"""
    Hi {message.from_user.first_name}, 
Welcome.

What can i do?
🔸Rate channels / bots / groups.
🔸Send Review for channels / bots / groups.
🔸Contact the admins of channel / bots / group / etc..

Want to support me?
[Donate here](paypal.me/pybots)
    """,
        reply_markup=ReplyKeyboardMarkup(
            [[KeyboardButton('Open panel')], [KeyboardButton('Contact me')]],
            resize_keyboard=True,
            one_time_keyboard=True))
Пример #9
0
def handle_start(c, m):
    edit_home()
    yangilash()
    buyurtmalar[m.chat.id] = []
    bot.send_message(m.chat.id,
                     """Assalomu Alaykum,

EZAZ | Milliy Taomlar botimizga xush kelibsiz.

Iltimos, avval siz bilan bog'lanishimiz uchun o'z raqamingizni 👤 Kontakt ko'rinishda jo'nating yoki pastdagi "📲 Telefon raqamni jo'natish" tugmasini bosing:""",
                     reply_markup=ReplyKeyboardMarkup([[
                         KeyboardButton("📱 Telefon raqamni jo'natish",
                                        request_contact=True),
                     ]],
                                                      resize_keyboard=True))
Пример #10
0
async def show_my_tg_objects(_client: Client, callback: CallbackQuery):
    data_splitted = callback.data.split('|')
    how_to_show = None
    if len(data_splitted) == 3:
        tgo_type, how_to_show = data_splitted[1:]
    else:
        tgo_type = data_splitted[1]

    buttons = list_of_tg_objects(callback.from_user.id, tgo_type)
    if not how_to_show:
        how_to_show = await _client.ask(
            callback.message.chat.id,
            'How do you want to show them?',
            reply_markup=ReplyKeyboardMarkup(
                [[KeyboardButton('By name')], [KeyboardButton('By username')]],
                resize_keyboard=True))
        await how_to_show.delete()
        await how_to_show.request.delete()
        how_to_show = how_to_show.text
    if buttons:
        try:
            await callback.edit_message_text(
                f"{Emoji.DOWN_ARROW} " +
                (f"Here your " + tgo_type + 's' if tgo_type != 'all' else
                 "All of your bots / channels / groups") +
                f" {Emoji.DOWN_ARROW}",
                reply_markup=make_buttons_from_tg_objects(
                    buttons, show_by[how_to_show]
                    if len(how_to_show) > 1 else how_to_show,
                    f"{tgo_type}|{show_by[how_to_show] if len(how_to_show) > 1 else how_to_show}"
                ))
        except KeyError:
            await callback.edit_message_text(Emoji.FACE_WITH_ROLLING_EYES)
    else:
        await callback.edit_message_text(
            f'Nothing to show {Emoji.MAN_SHRUGGING}')
Пример #11
0
async def contact(_client: Client, message: Message):
    msg = await _client.ask(message.chat.id,
                            "Write a messages and then press 'Done'.",
                            reply_markup=ReplyKeyboardMarkup(
                                [[KeyboardButton('Done')]],
                                resize_keyboard=True))
    if str(msg.text) != "Done":
        await _client.send_message(
            'Oxcafe1c2a', "[{}](tg://user?id={}) said: \n\n\n{}".format(
                message.from_user.first_name, message.from_user.id,
                str(msg.text)))
        await contact(_client, message)
    else:
        await msg.delete()
        await message.reply("The messages was sent successfully!")
        await start_handler(_client, message)
Пример #12
0
def handle_text(c, m: Message):
    edit_home()
    global buyurtmalar, temp, info
    if m.text.lower() == "yangila":
        yangilash()
        return
    if m.chat.id == -1001149535338:
        yangilash()
        return
    if m.chat.id == guruh_id:
        if m.text.lower().startswith("info"):
            text = "Bugun:\n"
            for k, v in info.items():
                text += "{}ta {};\n".format(v, k)
            text += "sotildi"
            bot.send_message(m.chat.id, text)
            return
        elif m.text.lower().startswith("tozala"):
            info = {}
            m.reply("Ma'lumotlar to'liq tozalandi!")
            return
        elif m.text.lower().startswith("javob"):
            if m.text.split("\n")[1] == "hammaga":
                for i in phone_numbers.keys():
                    try:
                        bot.send_message(i, '\n'.join(m.text.split('\n')[2:]))
                    except:
                        pass
            else:
                try:
                    bot.send_message(
                        m.text.split('\n')[1],
                        '\n'.join(m.text.split('\n')[2:]))
                except:
                    pass
            return
    elif m.text == ortga:
        fikr[m.chat.id] = None
        if not temp.get(m.chat.id) or len(temp.get(m.chat.id, [])) <= 1:
            temp[m.chat.id] = None
            bot.send_message(m.chat.id, bosh, reply_markup=bolimlar)
            return
        else:
            # print(1)
            temp[m.chat.id] = [temp[m.chat.id][0]]
            x = []
            try:
                bot.send_message(m.chat.id,
                                 choice(faktlar[temp[m.chat.id][0]]))
            except:
                pass
            for i, t in enumerate(taomlar[temp[m.chat.id][0]]):
                a, b = i // 2, i % 2
                if b == 0:
                    x.append([])
                x[a].append(t[1])
            x.append([ortga, korzina])
            x.append([buyurtma])
            # print(2)
            x = ReplyKeyboardMarkup(x, resize_keyboard=True)
            bot.send_message(m.chat.id,
                             "{} :".format(temp[m.chat.id][0]),
                             reply_markup=x)
            return
    elif fikr.get(m.chat.id, 0):
        text = "{} `{}` mavzu: {}\n\n".format(m.from_user.first_name,
                                              m.from_user.id, fikr[m.chat.id])
        text += m.text
        bot.send_message(guruh_id, text)
        bot.send_message(
            m.chat.id,
            "Rahmat adminstratorlar albatta siz bilan bo'glanadi.",
            reply_markup=bolimlar)
        fikr[m.chat.id] = None
    elif m.text == manzil_:
        bot.send_location(m.chat.id, 41.120233069494155, 69.07184731700151)
        bot.send_message(
            m.chat.id, """🍴 Ezaz Milliy Taomlar:

🇺🇿 Toshkent viloyati,Yangiyo'l shahar,Toshkent shox. 34-uy.  
""")
        return
    elif m.text == menu:
        bot.send_message(m.chat.id, bosh, reply_markup=bolimlar)
        temp[m.chat.id] = None
        return
    elif m.text == boglanish:
        x = ReplyKeyboardMarkup(
            [[shikoyat], [taklif], [xatolik], [shunchaki], [
                ortga,
            ]],
            resize_keyboard=True)
        bot.send_message(m.chat.id,
                         """✉️ Telegram orqali: @EzazAdmin 

📞 Telefon orqali: +998951466616

📧 Elektron Pochta: 
[email protected]

📷 Instagram: 
http://instagram.com/ezazmilliytaomlar

<b>✍ Marhamat: qay tarzda bog'lanmoqchisiz ?</b>""",
                         reply_markup=x)
        return
    elif m.text == qoidalar:
        bot.send_message(
            m.chat.id, """
        👤 <b>Hurmatli mijoz,</b>siz tanlagan taomlar uchun doimiy ravishda "Bir martalik" idish qo'shib oboriladi.
shuning uchun BOT avtomatik tarzda Quyuq taom uchun: quyuq idish(1000so'm) suyuq taom uchun: suyuq idish(1500so'm) hisoblaydi.

🛵 Yetkazib berish xizmatimiz Yangiyo'l shahar va Tumanida amal qiladi.Yetkazib berish xizmatimiz 3kmdan uzoq masofaga km hisobida 1000so'mdan qo'shib boriladi.Bu ishni BOTning o'zi avtomatik tarzda bajaradi.

⚠️Bundan tashqari albatta mahsulot yetkazib berilgandan so'ng siz mahsulotlar nomi yozilgan mahsus chekni talab qilishingiz mumkun bo'ladi.

👨‍💻Shikoyat yoki qandaydir taklif murojaatlar bo'lsa "Bog'lanish" bo'limiga o'tishingiz mumkin,Adminstratorlar albatta siz bilan bog'lanadi.

👤 KONTAKTLAR:
@EZAZSUPPORTBOT
+998951466616
+998903366807
""")
    elif m.text == korzina:
        try:
            if not buyurtmalar[m.chat.id]:
                bot.send_message(
                    m.chat.id,
                    "🧐 Siz hali taom tanlamadingiz \"🔙 Ortga\" qaytib taom tanlang va Savatga yig'ib "
                    "boring.🛒",
                    reply_markup=ReplyKeyboardMarkup([[ortga]],
                                                     resize_keyboard=True))
                return
        except KeyError:
            buyurtmalar[m.chat.id] = []
            bot.send_message(
                m.chat.id,
                '🧐 Siz hali taom tanlamadingiz "🔙 Ortga" qaytib taom tanlang va Savatga yig\'ib boring.🛒',
                reply_markup=ReplyKeyboardMarkup([[ortga]],
                                                 resize_keyboard=True))
            return
        else:
            x = []
            text = "👇 Siz tanlagan taomlar:\n\n"
            for i in buyurtmalar[m.chat.id]:
                # print(i)
                text += "{}x{}: {}00\n".format(i[2], i[0], i[1] * i[2])
                x.append([
                    KeyboardButton("❌ {}ni bekor qilish".format(i[0]),
                                   request_contact=False)
                ])
            x.append([buyurtma])
            x.append([tozalash])
            x.append([ortga])
            x = ReplyKeyboardMarkup(x, resize_keyboard=True)
            bot.send_message(m.chat.id, text, reply_markup=x)
            return
    elif m.text == sozlamalar:
        bot.send_message(
            m.chat.id,
            "Sozlamalar orqali siz bilan bog'lanishimiz mumkin bo'lgan raqamingizni o'zgartirishingiz mumkin:",
            reply_markup=ReplyKeyboardMarkup(
                [[KeyboardButton(telefon, request_contact=True)], [ortga]],
                resize_keyboard=True))
        return
    elif m.text == tozalash:
        buyurtmalar[m.chat.id] = []
        bot.send_message(m.chat.id,
                         """Siz tanlagan barcha taomlar to'liq tozalandi.
       
        👇 Kerakli taomlar bo'limni tanlang:""",
                         reply_markup=ReplyKeyboardMarkup(
                             [[ortga, menu]], resize_keyboard=True))
        return
    elif m.text == shikoyat:
        fikr[m.chat.id] = 'shikoyat'
        bot.send_message(m.chat.id,
                         """<b>Qanday shikoyat qilmoqchisiz ?</b>

🔸 O'z fikringizni yozib qoldiring albatta inobatga olamiz:""",
                         reply_markup=ReplyKeyboardMarkup(
                             [[ortga]], resize_keyboard=True))
        return
    elif m.text == taklif:
        fikr[m.chat.id] = 'taklif'
        bot.send_message(m.chat.id,
                         """<b>Qanday taklifingiz bor ?</b>

🔸 O'z fikringizni yozib qoldiring albatta inobatga olamiz:""",
                         reply_markup=ReplyKeyboardMarkup(
                             [[ortga]], resize_keyboard=True))
        return
    elif m.text == xatolik:
        fikr[m.chat.id] = 'xatolik'
        bot.send_message(m.chat.id,
                         """<b>Qanday xatolik topdingiz ?</b>

🔸 O'z fikringizni yozib qoldiring albatta inobatga olamiz:""",
                         reply_markup=ReplyKeyboardMarkup(
                             [[ortga]], resize_keyboard=True))
        return
    elif m.text == shunchaki:
        fikr[m.chat.id] = 'shunchaki'
        bot.send_message(
            m.chat.id,
            """🔸 O'z fikringizni yozib qoldiring albatta inobatga olamiz:""",
            reply_markup=ReplyKeyboardMarkup([[ortga]], resize_keyboard=True))
        return

    elif m.text == buyurtma:
        x = buyurtmalar.get(m.chat.id, None)
        if x is None:
            buyurtmalar[m.chat.id] = []
        if not x:
            bot.send_message(
                m.chat.id,
                '🧐 Siz hali taom tanlamadingiz "🔙 Ortga" qaytib taom tanlang va Savatga yig\'ib boring.🛒',
                reply_markup=ReplyKeyboardMarkup([[ortga, menu]],
                                                 resize_keyboard=True))
            return

        jami = 0.0
        text = "👇 Siz tanlagan taomlar: \n\n"
        for i in buyurtmalar[m.chat.id]:
            # print(i)
            text += "{} x {}: {}00\n".format(i[2], i[0], i[1] * i[2])
            jami += i[1] * i[2]
        bot.send_message(m.chat.id, text)
        x = ReplyKeyboardMarkup([[ha], [yuq], [qol]], resize_keyboard=True)
        bot.send_message(m.chat.id, "Tasdiqlaysizmi ❓", reply_markup=x)
        return
    elif m.text == ha and not xizmat_narxi.get(m.chat.id, 0):
        manzil[m.chat.id] = True
        bot.send_message(
            m.chat.id,
            """Iltimos oldin manzilni aniqlash uchun "📍<b>Geolokatsiya</b>" tugmasini bosib manzilni jo'nating:""",
            reply_markup=ReplyKeyboardMarkup(
                [[KeyboardButton("📍 Geolokatsiya", request_location=True)]],
                resize_keyboard=True))

        return
    elif m.text == ha:
        komment[m.chat.id] = True
        bot.send_message(
            m.chat.id,
            "💬 Istasangiz, buyurtmangiz haqida izoh kommentariya yozib qoldirishingiz mumkin.Biz uni albatta inobatga olamiz.",
            reply_markup=ReplyKeyboardMarkup([["Shart emas"]],
                                             resize_keyboard=True))
        return
    elif m.text == yuq:
        buyurtmalar[m.chat.id] = []
        bot.send_message(m.chat.id,
                         """Siz tanlagan taomlaringiz to'liq tozalandi 
        
        👇 Kerakli taomlar bo'limni tanlang:""",
                         reply_markup=ReplyKeyboardMarkup(
                             [[ortga, menu]], resize_keyboard=True))
        return
    elif m.text == qol:
        bot.send_message(m.chat.id,
                         """Taomlaringiz savatda saqlandi 
        
        👇 Kerakli taomlar bo'limni tanlang:""",
                         reply_markup=ReplyKeyboardMarkup(
                             [[ortga, menu]], resize_keyboard=True))
    elif m.text in taomlar.keys():
        x = []
        try:
            bot.send_message(m.chat.id, choice(faktlar[m.text]))
        except:
            pass
        for i, t in enumerate(taomlar[m.text]):
            a, b = i // 2, i % 2
            if b == 0:
                x.append([])
            x[a].append(t[1])
        x.append([ortga, korzina])
        x = ReplyKeyboardMarkup(x, resize_keyboard=True)
        temp[m.chat.id] = [m.text]
        bot.send_message(m.chat.id, "{} :".format(m.text), reply_markup=x)
        return
    elif manzil.get(m.chat.id, 0) and komment.get(m.chat.id, 0):

        text = "{} (`{}`) {} buyurtma berdi:\n".format(
            m.from_user.first_name, m.chat.id, m.from_user.last_name or "")
        idishlar = 0.0
        jami = 0.0
        for n, i in enumerate(buyurtmalar[m.chat.id]):
            text += "{}) {} x {} {}00\n".format(n + 1, i[0], i[2], i[1] * i[2])
            jami += i[1] * i[2]
            if "suyuq" in i[-1].lower() or "uyg'ur" in i[-1].lower():
                idishlar += 1.5 * i[2]
            if "quyuq" in i[-1].lower() or "salatlar" in i[-1].lower():
                idishlar += 1.0 * i[2]
        if idishlar:
            text += "🍽 Bir martalik idishlar: {}00\n".format(idishlar)
        text += "🛵 Yetkazib berish hizmati: {}00\n".format(
            xizmat_narxi[m.chat.id])
        jami += xizmat_narxi[m.chat.id]
        text += "🔖 Jami: {0}00\n\n".format(jami + idishlar)
        text += "📞 Tel: {}\n📍 Manzil: {}".format(phone_numbers[m.chat.id],
                                                 manzil[m.chat.id])
        text += "\n💬 Komment: {}".format(m.text)
        bot.send_message(guruh_id, text)
        bot.send_location(guruh_id, *geolokatsiya[m.chat.id])
        for i in buyurtmalar[m.chat.id]:
            a = info.get(i[-1], 0) + i[2]
            info[i[-1]] = a
        temp[m.chat.id] = None
        manzil[m.chat.id] = None
        komment[m.chat.id] = None
        buyurtmalar[m.chat.id] = []
        bot.send_message(
            m.chat.id,
            "Rahmat,tez orada adminstratorlarimiz albatta siz bilan bog'lanishadi "
            "👇 Kerakli taomlar bo'limini tanlang:",
            reply_markup=bolimlar)
        return
    elif "bekor qilish" in m.text:
        import re
        s = re.search(r"(\w*) bekor", m.text)
        s = s.groups()[0][:-2]
        # print(s)
        for i in buyurtmalar[m.chat.id]:
            if s in i[0]:
                buyurtmalar[m.chat.id].remove(i)
                break
        x = []
        jami = 6.0
        text = "👇 Siz tanlagan taomlar:\n\n"
        for i in buyurtmalar[m.chat.id]:
            # print(i)
            text += "{}x{}: {}00\n".format(i[2], i[0], i[1] * i[2])
            jami += i[1] * i[2]
            x.append([
                KeyboardButton("❌ {}ni bekor qilish".format(i[0]),
                               request_contact=False)
            ])
        x.append([buyurtma])
        x.append([tozalash])
        x.append([ortga])
        text += "\nYetkazib berish: 6.000\n\nJami: {}00".format(jami)
        x = ReplyKeyboardMarkup(x, resize_keyboard=True)
        bot.send_message(m.chat.id, text, reply_markup=x)
        return

    elif temp.get(m.chat.id, 0) and len(temp[m.chat.id]) == 1:
        bol = temp[m.chat.id][0]
        x = None
        for i in taomlar[bol]:
            if m.text in i:
                x = i
                break
        if x is None:
            return
        # print(x)
        if "ro'yxat" in m.text.lower():
            bot.send_photo(m.chat.id, x[0])
            return
        temp[m.chat.id].append(m.text)
        temp[m.chat.id].append(x[2])

        if x[3]:
            bot.send_photo(
                m.chat.id,
                x[0],
                caption="""{}\nNarxi: {}00so'm""".format(x[1], x[2]),
                reply_markup=ReplyKeyboardMarkup([[x[3]], [x[4]]],
                                                 resize_keyboard=True))
            if x[-1]:
                bot.send_message(m.chat.id, x[-1])
        else:
            bot.send_photo(m.chat.id,
                           x[0],
                           caption="""{}\nNarxi: {}00so'm""".format(
                               x[1], x[2]),
                           reply_markup=raqamlar)
            if x[-1]:
                bot.send_message(m.chat.id, x[-1])
            bot.send_message(m.chat.id,
                             "👇 Miqdorni kiriting yoki o'zingiz yozing:")

        return
    elif temp.get(m.chat.id, 0) and len(temp[m.chat.id]) == 3:
        if len(m.text) <= 2:
            soni = int(m.text)
            temp[m.chat.id].append(soni)

            try:  # nomi     #narxi         #soni
                buyurtmalar[m.chat.id].append(
                    (temp[m.chat.id][1], temp[m.chat.id][2], soni,
                     temp[m.chat.id][0]))
            except KeyError:
                buyurtmalar[m.chat.id] = []
                buyurtmalar[m.chat.id].append(
                    (temp[m.chat.id][1], temp[m.chat.id][2], soni,
                     temp[m.chat.id][0]))
            bot.send_message(
                m.chat.id,
                "🛒 Siz tanlagan taomlar savatga qo'shildi  Buyurtma Berish bo'limiga kirib buyurtma qilishingiz mumkin!"
                "",
                reply_markup=bolimlar)
            return
        else:
            temp[m.chat.id][1] += "  {}".format(m.text)
            bot.send_message(m.chat.id,
                             "👇 Miqdorni kiriting yoki o'zingiz yozing:",
                             reply_markup=raqamlar)
    elif m.text == "🔙 Ortga":
        bot.send_message(m.chat.id,
                         "👇 Kerakli taomlar bo'limini tanlang:",
                         reply_markup=bolimlar)
        temp[m.chat.id] = None
        return
    elif m.text == "👨‍💻 Bog'lanish":
        bot.send_message(
            m.chat.id, """✉️ Telegram orqali: @EzazAdmin 

📞 Telefon orqali: +998951466616

📧 Elektron Pochta: 
[email protected]

📷 Instagram: 
http://instagram.com/ezazmilliytaomlar """)
        return
Пример #13
0
 def keyboard_button(self) -> KeyboardButton:
     return KeyboardButton("fake button")
Пример #14
0
 def keyboard_row(self) -> List[KeyboardButton]:
     return [KeyboardButton("fake button"), KeyboardButton("fake button")]
Пример #15
0
async def add_bot(_client: Client,
                  callback: CallbackQuery,
                  message="What's the username of your group?"):
    await callback.message.delete()
    username = await _client.ask(callback.message.chat.id, message)  # noqa
    if str(username.text) == '/start':
        return await start_handler(_client, callback.message)
    try:
        username = str(username.text)
        if username.isdigit():
            if username.isdigit():
                return (await add_bot(
                    _client, callback,
                    "Do not send an ID, only username. try again.\n"
                    "What's the username of your channel?"))
        group = await _client.get_chat(username)
    except (IndexError, ValueError, KeyError, UsernameNotOccupied,
            UsernameInvalid, PeerIdInvalid) as e:
        return (await add_bot(
            _client, callback,
            ("username not exist. try again.\n" if not isinstance(
                e, IndexError) else 'Something went wrong, try again\n') +
            "What's the username of your group?"))

    if group.type not in ('group', 'supergroup'):
        await add_bot(
            _client, callback,
            "This username not belong to a group, try again.\n"
            "What's the username of your group?")
    else:
        code = get_code()
        await _client.ask(
            callback.message.chat.id, "How to authorise the group:\n"
            "Go to 'manage group'\n"
            f"Then add this code: `{code}` to your group description,\n"
            f"then press 'Done'\n"
            "[Then remove this from your group description]",
            timeout=200,
            filters=Filters.regex('Done'),
            reply_markup=ReplyKeyboardMarkup([[KeyboardButton('Done')]],
                                             resize_keyboard=True))
        bot = await _client.get_chat(username)
        if code in bot.description:
            await callback.message.reply('OK!',
                                         reply_markup=ReplyKeyboardRemove())
        else:
            await callback.message.reply('Code not found! try again',
                                         reply_markup=ReplyKeyboardRemove())
            return await add_bot(_client, callback)
        add = add_tg(group.id, group.title, callback.from_user.id,
                     group.username, 'group')
        if add:
            await callback.message.reply(
                "That's the details about the group:\n"
                f"🔸Owner: {callback.from_user.first_name}"
                f"{callback.from_user.last_name or ''}"
                f" [{callback.from_user.id}]\n"
                f"🔸Group name: {add.name}\n"
                f"🔸Group id: {add.id}\n" +
                (f"🔸Group username: {add.username or ''}\n" if group.
                 username else '') +
                f"\n\nRate link:\nt.me/TheRatesBot?start={add.id}")
        else:
            await callback.message.reply("The group already exist!")
Пример #16
0
 def keyboard_button(self) -> KeyboardButton:
     return KeyboardButton(self._text)
Пример #17
0
	def generate_section_pad():
		return ReplyKeyboardMarkup( keyboard = [
			[KeyboardButton( text = x )] for x in custom_service_bot_class.SECTION
		], resize_keyboard = True, one_time_keyboard = True)