Exemplo n.º 1
0
def start_message(message):
    keyboard = types.InlineKeyboardMarkup()
    url_button = types.InlineKeyboardButton(
        text="Join to the Proton Channel", url="https://t.me/xprannouncements")
    keyboard.add(url_button)
    name = message.from_user.first_name
    WELCOME_MESSAGE = f"""
    <b>{name}! Welcome to the PROTON telegram!</b>  
You can find the exchanges PROTON is listed on <a href="protonchain.com">here</a>.
Regards, 
Proton Team
    """
    bot.send_message(
        message.from_user.id,
        WELCOME_MESSAGE,
        parse_mode='html',
        disable_web_page_preview=True,
        reply_markup=keyboard,
    )
    if message.chat.id == GROUP_ID:
        bot.delete_message(message.chat.id, message.message_id)

    if message.from_user.username not in user_dict.keys():
        captcha_text = create_random_captcha_text()
        captcha_list.append(captcha_text)
        create_image_captcha(captcha_text)
        image_file = "image/captcha_" + captcha_text + ".png"
        bot.send_photo(message.from_user.id, open(image_file, 'rb'))
        bot.register_next_step_handler(message, check_captcha)
Exemplo n.º 2
0
def chat_q(message):
    if message.from_user.username not in user_dict.keys():
        bot.delete_message(message.chat.id, message.message_id)
        keyboard = types.InlineKeyboardMarkup()
        url_button = types.InlineKeyboardButton(
            text="Proton bot", url="https://t.me/Test578957_bot?start=666")
        keyboard.add(url_button)
        WELCOME_MESSAGE = f"""
            <b>Пройди верефикацию, чтобы писать в чате.</b> 
            """
        bot.send_message(
            message.from_user.id,
            WELCOME_MESSAGE,
            parse_mode='html',
            disable_web_page_preview=True,
            reply_markup=keyboard,
        )
    elif len(message.text) != 3 and message.text.split()[1].isdigit() is False:
        bot.delete_message(message.chat.id, message.message_id)
        bot.send_message(
            message.from_user.id,
            f'Неправильный формат: /tip count @name',
        )
    else:
        sm = message.text.split()[1]
        res_name = message.text.split()[2]
        res_name = res_name[1:]
        my_name = message.from_user.username
        if res_name in user_dict.keys():
            nm = user_dict.get(res_name)
            bal2 = int(nm['balance']) + int(sm)
            nm1 = user_dict.get(my_name)
            iid = nm['id']
            bal1 = int(nm1['balance']) - int(sm)
            nl = int(nm1['balance'])
            bot.delete_message(message.chat.id, message.message_id)
            if int(nm1['balance']) >= int(sm):
                bot.send_message(
                    iid,
                    f'Вам пришел перевод {sm} от {my_name}. Ваш баланс {bal2}',
                )
                nm['balance'] = bal2
                bot.send_message(
                    message.from_user.id,
                    f'Отпралено {sm}. Ваш баланс {bal1}',
                )
                nm1['balance'] = bal1
            else:
                bot.send_message(
                    message.from_user.id,
                    f'Недостаточно средств. Ваш баланс {nl}',
                )
        else:
            bot.send_message(
                message.from_user.id,
                f'Пользователь {res_name} не найден',
            )
            bot.delete_message(message.chat.id, message.message_id)
Exemplo n.º 3
0
def inline(message):
    if message.from_user.username not in user_dict.keys():
        bot.delete_message(message.chat.id, message.message_id)
        keyboard = types.InlineKeyboardMarkup()
        url_button = types.InlineKeyboardButton(
            text="Proton bot", url="https://t.me/Test578957_bot?start=666")
        keyboard.add(url_button)
        WELCOME_MESSAGE = f"""
            <b>Пройди верефикацию, чтобы писать в чате.</b> 
            """
        bot.send_message(
            message.from_user.id,
            WELCOME_MESSAGE,
            parse_mode='html',
            disable_web_page_preview=True,
            reply_markup=keyboard,
        )
    elif len(message.text) != 2 and message.text.split()[1].isdigit() is False:
        bot.delete_message(message.chat.id, message.message_id)
        bot.send_message(
            message.from_user.id,
            f'Неправильный формат: /airdrop count',
        )
    else:
        sm = message.text.split()[1]
        my_name = message.from_user.username
        nm1 = user_dict.get(my_name)
        rrm = nm1['balance']
        bal1 = int(nm1['balance']) - int(sm)
        bot.delete_message(message.chat.id, message.message_id)
        if int(nm1['balance']) >= int(sm):
            global fin
            fin = sm
            key = types.InlineKeyboardMarkup()
            but_1 = types.InlineKeyboardButton(text="Submit",
                                               callback_data="Submit")
            key.add(but_1)
            bot.send_message(message.chat.id,
                             f"Участвовать на {sm}",
                             reply_markup=key)
            bot.send_message(
                message.from_user.id,
                f'Cписано {sm}. Ваш баланс {bal1}',
            )

            nm1['balance'] = int(nm1['balance']) - int(sm)
        else:
            bot.send_message(
                message.from_user.id,
                f'Недостаточно средств. Ваш баланс {rrm}',
            )
Exemplo n.º 4
0
async def msg_enter_location_name(message):
    await message.answer(language.msg_send_me_new_name_add())
    # await message.answer("Send me new name for this location😁 and then click Add.")
    change_status("Enter location name")
    global global_response
    global new_name_str
    new_name_str = create_name(message,
                               air_info.get_city_country(global_response))
    await message.answer(language.msg_if_you_will_not_send_it(new_name_str),
                         parse_mode=ParseMode.HTML,
                         reply_markup=kb.add(language))
Exemplo n.º 5
0
def get_text_messages(message):
    if message.chat.id == GROUP_ID:
        if message.from_user.username not in user_dict.keys():
            bot.delete_message(message.chat.id, message.message_id)
            keyboard = types.InlineKeyboardMarkup()
            url_button = types.InlineKeyboardButton(
                text="Proton bot", url="https://t.me/Test578957_bot?start=666")
            keyboard.add(url_button)
            WELCOME_MESSAGE = f"""
                <b>Пройди верефикацию, чтобы писать в чате.</b> 
                """
            c = bot.send_message(
                message.chat.id,
                WELCOME_MESSAGE,
                parse_mode='html',
                disable_web_page_preview=True,
                reply_markup=keyboard,
            )
            time.sleep(5)
            bot.delete_message(c.chat.id, c.message_id)
Exemplo n.º 6
0
def handler_new_member(message):
    bot.delete_message(message.chat.id, message.message_id)
    keyboard = types.InlineKeyboardMarkup()
    url_button = types.InlineKeyboardButton(text="Proton bot",
                                            url="https://t.me/Test578957_bot")
    keyboard.add(url_button)
    name = message.new_chat_members[0].first_name
    WELCOME_MESSAGE = f"""
        <b>{name}! Пройди верефикацию, чтобы писать в чате.</b> 
        """
    w = bot.send_message(
        message.chat.id,
        WELCOME_MESSAGE,
        parse_mode='html',
        disable_web_page_preview=True,
        reply_markup=keyboard,
    )
    time.sleep(5)

    bot.delete_message(w.chat.id, w.message_id)
Exemplo n.º 7
0
async def get_location_name(message):
    global new_name_str
    global str_no_conflict
    new_name_str_temp = message.text
    if len(new_name_str_temp) > 50:
        await message.answer(language.msg_maximum_length_50(),
                             reply_markup=kb.add(language))
    elif check_name_db(message, new_name_str_temp):
        await message.answer(language.msg_such_name_is_already_exists())
    else:
        if new_name_str_temp == language.button_add:
            str_no_conflict = True
        else:
            new_name_str = new_name_str_temp
            str_no_conflict = True