コード例 #1
0
def command_pay(message):
    log_text(message.chat.id, message.message_id, '--- DONATE --- ')
    if str(message.from_user.id) in BANNED:
        log_text(message.chat.id, message.message_id,
                 '--- BANIDO --- ' + message.text)
        bot.send_message(message.chat.id, msgs.banned)
        return 0
    send_clean_msg(bot, message.chat.id, msgs.donate_warn)
    bot.send_invoice(
        message.chat.id,
        title='RastreioBot',
        description='Para doar R$ 10, clique no botão abaixo.',
        provider_token=STRIPE,
        currency='BRL',
        prices=[types.LabeledPrice(label='Doar R$ 10', amount=1000)],
        start_parameter='doar10',
        invoice_payload='RastreioBot')
    bot.send_invoice(
        message.chat.id,
        title='RastreioBot',
        description='Para doar R$ 15, clique no botão abaixo.',
        provider_token=STRIPE,
        currency='BRL',
        prices=[types.LabeledPrice(label='Doar R$ 15', amount=1500)],
        start_parameter='doar15',
        invoice_payload='RastreioBot')
コード例 #2
0
def cmd_pacotes(message):
    bot.send_chat_action(message.chat.id, 'typing')
    if str(message.from_user.id) in BANNED:
        log_text(message.chat.id, message.message_id,
                 f'--- BANIDO --- {message.text}')
        bot.send_message(message.chat.id, msgs.banned)
        return 0
    chatid = message.chat.id
    message, qtd = list_packages(chatid, False, False)
    if qtd == 0:
        send_clean_msg(bot, chatid, msgs.not_found)
    elif qtd == -1:
        send_clean_msg(bot, chatid, msgs.error_bot)
    else:
        message = '<b>Clique para ver o histórico:</b>\n' + message
        msg_split = message.split('\n')
        for elem in range(0, len(msg_split) - 1, 10):
            s = '\n'
            bot.send_message(chatid,
                             s.join(msg_split[elem:elem + 10]),
                             parse_mode='HTML',
                             reply_markup=markup_clean,
                             disable_web_page_preview=True)

        try:
            subscriber = webhook.select_user('chatid', chatid)[1]
        except TypeError:
            subscriber = ''
        if qtd > 7 and chatid > 0 and str(chatid) not in subscriber:
            bot.send_message(chatid,
                             str(u'\U0001F4B5') + '<b>Colabore!</b>' +
                             '\nPicPay: http://grf.xyz/picpay',
                             parse_mode='HTML',
                             reply_markup=markup_clean,
                             disable_web_page_preview=True)
コード例 #3
0
ファイル: rastreiobot.py プロジェクト: mensonones/RastreioBot
def cmd_format(message):
    bot.reply_to(message, 'Formato inválido')
    bot.delete_message(message.from_user.id, message.message_id)
    # bot.reply_to(message, ('<a href="tg://user?id={}">{}</a>').format(message.from_user.id, message.from_user.first_name), parse_mode='HTML')
    send_clean_msg(bot, message.from_user.id,
                   msgs.invalid.format(message.from_user.id))
    log_text(message.chat.id, message.message_id, 'Formato inválido')
    print(message)
コード例 #4
0
ファイル: rastreiobot.py プロジェクト: ils15/RastreioBot
def command_sub(message):
    log_text(message.chat.id, message.message_id, '--- DONATE --- ')
    if str(message.from_user.id) in BANNED:
        log_text(message.chat.id, message.message_id,
                 '--- BANIDO --- ' + message.text)
        bot.send_message(message.chat.id, msgs.banned)
        return 0
    send_clean_msg(bot, message.chat.id, msgs.donate_warn)
    bot.send_photo(
        message.chat.id,
        'AgACAgEAAxkBAAFvCWVfuo6kDztK_xxQVSza4gkfNPkAAYgAAjSqMRtottlFTZa3_00eUpfumRIwAAQBAAMCAAN5AAMkFwQAAR4E',
        caption='PIX: [email protected]')
コード例 #5
0
ファイル: rastreiobot.py プロジェクト: mensonones/RastreioBot
def command_sub(message):
    log_text(message.chat.id, message.message_id, '--- DONATE --- ')
    if str(message.from_user.id) in BANNED:
        log_text(message.chat.id, message.message_id,
                 '--- BANIDO --- ' + message.text)
        bot.send_message(message.chat.id, msgs.banned)
        return 0
    send_clean_msg(bot, message.chat.id, msgs.donate_warn)
    #bot.send_photo(message.chat.id, 'AQADTnTvSBcAA9J2AwAB', caption='PIX: [email protected]')
    #bot.send_photo(message.chat.id, 'AgACAgEAAxkBAAFvCOFfuotdgSJTpJelCWxXEoRw6MTungACM6oxG2i22UWv08Gw0KYTLE5070gXAAMBAAMCAAN4AAPTdgMAAR4E', caption='PIX: [email protected]')
    bot.send_photo(
        message.chat.id,
        'AgACAgEAAxkBAAFvCWVfuo6kDztK_xxQVSza4gkfNPkAAYgAAjSqMRtottlFTZa3_00eUpfumRIwAAQBAAMCAAN5AAMkFwQAAR4E',
        caption='PIX: [email protected]')
コード例 #6
0
ファイル: rastreiobot.py プロジェクト: mensonones/RastreioBot
def command_pay(message):
    log_text(message.chat.id, message.message_id, '--- PAYMENT --- ')
    send_clean_msg(bot, message.chat.id, msgs.payment)
    bot.send_invoice(
        message.chat.id,
        title='RastreioBot - 6 meses',
        description=
        'Seis meses (183 dias) de rastreio de pacotes internacionais',
        provider_token=STRIPE,
        currency='BRL',
        prices=[types.LabeledPrice(label='Doar R$ 12', amount=1200)],
        start_parameter='doar12',
        invoice_payload='RastreioBot6meses')
    bot.send_invoice(
        message.chat.id,
        title='RastreioBot - 1 ano',
        description='Um ano (366 dias) de rastreio de pacotes internacionais',
        provider_token=STRIPE,
        currency='BRL',
        prices=[types.LabeledPrice(label='Doar R$ 20', amount=2000)],
        start_parameter='doar21',
        invoice_payload='RastreioBot1ano')
コード例 #7
0
ファイル: rastreiobot.py プロジェクト: mensonones/RastreioBot
def cmd_magic(message):
    '''
    Entry point for adding a tracking number
    '''
    bot.send_chat_action(message.chat.id, 'typing')
    if str(message.from_user.id) in BANNED:
        log_text(message.chat.id, message.message_id,
                 '--- BANIDO --- ' + message.text)
        bot.send_message(message.chat.id, msgs.banned)
        return 0
    log_text(message.chat.id, message.message_id, message.text)
    user = str(message.chat.id)
    message_text = (message.text.replace('/start ', '').replace(
        '/', '').replace('📮', '').strip().split())

    code = code_type = None
    for word in message_text:
        if word.lower() == '@rastreiobot':
            message_text.remove(word)

        code_type = check_type(word)
        if code_type:
            code = word.upper()
            message_text.remove(word)
            break

    message_text = ' '.join(message_text)

    try:
        desc = message_text.split('Data:')[0].replace('  ', '')
        if desc == '':
            desc = code
    except Exception:
        desc = code

    if code_type:
        try:
            subscriber = webhook.select_user('chatid', user)[1]
        except TypeError:
            subscriber = ''
        if code_type != correios and user not in PATREON and user not in subscriber:
            bot.reply_to(message,
                         msgs.premium,
                         parse_mode='HTML',
                         disable_web_page_preview=True)
            log_text(message.chat.id, message.message_id,
                     'Pacote chines. Usuario nao assinante.')
            return 0
        exists = check_package(code)
        if exists:
            if not db.package_has_user(code, user):
                db.add_user_to_package(code, user)
            stats = db.package_status(code)
            message = ''
            system = check_system_correios()
            for stat in stats:
                message = message + '\n\n' + stat
            if not system:
                message = (message + msgs.error_sys)
            if int(user) > 0:
                bot.send_message(user,
                                 message,
                                 parse_mode='HTML',
                                 reply_markup=markup_btn,
                                 disable_web_page_preview=True)
            else:
                send_clean_msg(bot, user, message)
            if desc != code:
                db.set_package_description(code, user, desc)
        else:
            stat = add_package(str(code), str(user))
            share_button = types.InlineKeyboardMarkup()
            share_button.row(
                types.InlineKeyboardButton(
                    "Compartilhar",
                    url="https://rastreiobot.xyz/?codigo=" + code))
            if stat == status.OFFLINE:
                bot.reply_to(message, 'Sistema fora do ar')
            elif stat == status.TYPO:
                bot.reply_to(message, msgs.typo)
                bot.delete_message(message.from_user.id, message.message_id)
            elif stat == status.NOT_FOUND:
                bot.reply_to(message, msgs.not_found)
            elif stat == status.NOT_FOUND_TM:
                bot.reply_to(message, msgs.not_found_tm)
            elif stat == status.OK:
                db.set_package_description(code, user, desc)
                if int(message.chat.id) > 0:
                    bot.reply_to(
                        message,
                        'Pacote cadastrado.\n\nCompartilhe usando o link abaixo:',
                        reply_markup=share_button)
                    print('share')
                    if desc == code:
                        send_clean_msg(bot, user, msgs.desc)
                else:
                    bot.reply_to(message,
                                 'Pacote cadastrado.',
                                 reply_markup=markup_clean)
                sttus = db.package_status(code)
                last = len(sttus) - 1
                if int(user) > 0:
                    bot.send_message(user,
                                     db.package_status(code)[last],
                                     parse_mode='HTML',
                                     reply_markup=markup_btn,
                                     disable_web_page_preview=True)
                else:
                    send_clean_msg(bot, user, db.package_status(code)[last])
    elif message.text.upper() == '/START':
        if int(message.chat.id) > 0:
            send_clean_msg(bot, message.chat.id, msgs.user)
            # bot.send_document(message.chat.id, 'CgADAQADhgAD45bBRvd9d-3ACM-cAg')
            # bot.send_document(message.chat.id, 'CgADAQADTAAD9-zRRl9s8doDwrMmAg')
            # bot.send_document(message.chat.id, 'CgADAQADPgADBm7QRkzGU7UpR3JzAg')
            try:
                bot.send_document(message.chat.id,
                                  'CgADAQADWQADGu_QRlzGc4VIGIYaAg')
            except telebot.apihelper.ApiException:
                pass
        else:
            send_clean_msg(bot, message.chat.id, msgs.group)
    else:
        if int(user) > 0:
            bot.reply_to(message, msgs.typo)
            bot.delete_message(message.from_user.id, message.message_id)
        if int(user) > 0 and len(message.text) > 25:
            send_clean_msg(bot, message.from_user.id,
                           msgs.invalid.format(message.from_user.id))
コード例 #8
0
ファイル: rastreiobot.py プロジェクト: mensonones/RastreioBot
def cmd_repetir(message):
    bot.send_chat_action(message.chat.id, 'typing')
    if int(message.chat.id) > 0:
        send_clean_msg(bot, message.chat.id, msgs.user)
    else:
        send_clean_msg(bot, message.chat.id, msgs.group)