Exemple #1
0
def send_welcomeaa(client, message):
    tg_analytic.statistics(message.chat.id, "balance")
    data = db.create_user(message.chat.id)
    balance = round(cache.get_balance(message.chat.id))
    usd = round(cache.get_price() * float(balance) * cache.get_price_like(), 2)
    app.send_message(message.chat.id,
                     f"You've got {balance} LIKE.\nThat's about ${usd}",
                     reply_markup=help_markup)
Exemple #2
0
def spend(client, message):
    tg_analytic.statistics(message.chat.id, "spend")
    #data = cache.get_tap_mn_push(message)
    data1 = cache.get_tap_minter_push(message)
    app.send_message(message.chat.id, f"Your LIKEs are like money, spend on anything:", parse_mode="Markdown", reply_markup=InlineKeyboardMarkup(
        [
          #  [InlineKeyboardButton("Tap mn", url=f"https://tap.mn/{data}")],
            [InlineKeyboardButton("Minterpush", url=data1)]
        ]))
Exemple #3
0
def process_category_step(message):
    try:
        chat_id = message.chat.id
        user_dict[chat_id] = User(message.text)
        bot.send_chat_action(message.chat.id, 'typing')
        time.sleep(1)
        msg = bot.send_message(message.chat.id, 'Выберите услугу 1', reply_markup=keyboard.service1)
        tg_analytic.statistics (message.chat.id, message.text)
        bot.register_next_step_handler(msg, process_head_step)

    except Exception as e:
        bot.reply_to(message, '⚠ Ошибка, мы исправим')
Exemple #4
0
def like_ddd(client, message):
    global caches
    userid = message["from_user"]["id"]
    add_message_to_cache(message)
    tg_analytic.statistics_chat(message.chat.id, get_title_chat(message))
    value_to_send = int(message.text.split(" ")[1])
    if message.reply_to_message.from_user.id != message["from_user"][
            "id"] and not message["reply_to_message"]["from_user"][
                "is_bot"] and value_to_send > 0:
        mnemonic = db.get_mnemo(userid)
        wallet = Wallet(seed=mnemonic)
        balance = db.get_balance(userid)
        value_to_send = correct_value_balance(value_to_send, balance)
        owner = get_owner_chat(app, message)
        to_address = db.create_user(message.reply_to_message.from_user.id)
        if value_to_send > 0.01:
            if owner != None:
                owner_dat = db.create_user(owner.user.id)
                # Check if like sending to owner of group or from him
                if wallet.address == owner_dat[2] or owner_dat[
                        2] == to_address[2]:
                    owner = None
                else:
                    wallet.send(to=owner_dat[2],
                                value=0.1 * float(value_to_send),
                                coin="LIKE",
                                payload='',
                                include_commission=True)
            if owner == None:
                transaction = wallet.send(to=to_address[2],
                                          value=float(value_to_send),
                                          coin="LIKE",
                                          payload='',
                                          include_commission=True)
            else:
                transaction = wallet.send(to=to_address[2],
                                          value=0.9 * float(value_to_send),
                                          coin="LIKE",
                                          payload='',
                                          include_commission=True)
            if transaction != None:
                # If result success send message to chat
                if not 'error' in transaction["result"]:
                    a = message["reply_to_message"].reply_text(
                        "Your message was liked by  " + get_name(message) +
                        "'s message! [Spend your coins](https://t.me/MinterLikeBot)",
                        parse_mode="Markdown",
                        disable_web_page_preview=True)
                    tg_analytic.statistics(message.chat.id, "emoji like", True,
                                           value_to_send)
                    threading.Thread(target=delete_message,
                                     args=(a.chat.id, a.message_id)).start()
Exemple #5
0
def topup(client, message):
    tg_analytic.statistics(message.chat.id, "topup")
    data = db.create_user(message.chat.id)
    keyboard_markup = InlineKeyboardMarkup([[
        InlineKeyboardButton("QR Code", callback_data="qr_code"),
        InlineKeyboardButton("Address", callback_data="address"),
        InlineKeyboardButton("BIP Wallet", url=data[-1])
    ]])
    app.send_message(
        message.chat.id,
        f"To top up your balance use one of the following options.\n\n<i>Hint: You've got to know a bit about crypto or ask your friend to help.</i>",
        parse_mode="html",
        reply_markup=keyboard_markup)
Exemple #6
0
def echo(chat_id, query_id, query_data, text: str, custom_reply_markup=None, alert_text=None, show_alert=False):
    try:
        message_id = event.user_select_message_id(chat_id)
        bot.edit_message_text(text,
                              chat_id=chat_id,
                              message_id=message_id,
                              parse_mode="Markdown",
                              reply_markup=custom_reply_markup)
        bot.answer_callback_query(query_id, text=alert_text, show_alert=show_alert)
        tg_analytic.statistics(chat_id, query_data)
    except telebot.apihelper.ApiTelegramException:
        return
    except KeyError:
        return
Exemple #7
0
def like_d(client, message):  # For asynchronity because Minter SDK doesnt support asyncio
    add_message_to_cache(message)
    tg_analytic.statistics_chat(message.chat.id, get_title_chat(message))
    if message.reply_to_message and not "edit_date" is message and message.reply_to_message.from_user.id != message["from_user"]["id"] and not message["reply_to_message"]["from_user"]["is_bot"]:
        # Get owner chat for sending commision
        owner_chat = get_owner_chat(app, message)
        # Get count like for detect how many need send
        count_emoji = correct_count_emoji(is_emoji(message.text))
        value_to_send = correct_value_to_send(
            10 ** (count_emoji - 1))  # Correct if count emoji < 1
        # Get user from whom will send LIKE
        user = db.create_user(message["from_user"]["id"])
        user_balance = db.get_balance(
            message["from_user"]["id"])  # Get balance user
        value_to_send = correct_value_balance(
            float(value_to_send), float(user_balance))
        wallet = Wallet(seed=db.get_mnemo(
            message["from_user"]["id"]))  # Wallet of user
        to_address = db.create_user(
            message["reply_to_message"]["from_user"]["id"])
        if owner_chat != None:  # Check if owner exists
            owner_dat = db.create_user(owner_chat.user.id)
            # Check if like sending to owner of group or from him
            if wallet.address == owner_dat[2] or owner_dat[2] == to_address[2]:
                owner_chat = None
        if value_to_send > 0.01:
            if owner_chat != None:  # If owner exists send to him some LIKE
                wallet.send(to=owner_dat[2], value=0.1 * value_to_send,
                            coin="LIKE", payload='', include_commission=True)
                transaction = wallet.send(to=to_address[
                                          2], value=0.9 * value_to_send, coin="LIKE", payload='', include_commission=True)
            else:
                transaction = wallet.send(to=to_address[
                                          2], value=value_to_send, coin="LIKE", payload='', include_commission=True)

            if transaction != None:
                # If result success send message to chat
                if not 'error' in transaction["result"]:
                    tg_analytic.statistics(
                        message.chat.id, "emoji like", True, value_to_send)
                    a = message["reply_to_message"].reply_text("Your message was liked by " + get_name(
                        message) + "! [Spend your coins](https://t.me/MinterLikeBot)", parse_mode="Markdown", disable_web_page_preview=True)
                    threading.Thread(target=delete_message, args=(
                        a.chat.id, a.message_id)).start()  # Delete message
Exemple #8
0
def handle_text(message):
    tg_analytic.statistics(message.chat.id, message.text)
    if message.text == 'команда а':
        text = 'Использована команда а'
        bot.send_message(message.chat.id, text, reply_markup=user_markup)

    if message.text == 'команда б':
        s1 = 'Использована команда б'
        tg_analytic.statistics(message.chat.id, message.text)
        bot.send_message(message.chat.id, s1, reply_markup=user_markup)
    if message.text == 'команда в':
        s1 = 'Использована команда в'
        tg_analytic.statistics(message.chat.id, message.text)
        bot.send_message(message.chat.id, s1, reply_markup=user_markup)
    if message.text[:10] == 'статистика' or message.text[:10] == 'Cтатистика':
        st = message.text.split(' ')
        if 'txt' in st or 'тхт' in st:
            tg_analytic.analysis(st, message.chat.id)
            with open('%s.txt' % message.chat.id, 'r',
                      encoding='UTF-8') as file:
                bot.send_document(message.chat.id, file)
            tg_analytic.remove(message.chat.id)
        else:
            messages = tg_analytic.analysis(st, message.chat.id)
            bot.send_message(message.chat.id, messages)
Exemple #9
0
def send_welcome(client, message):
    tg_analytic.statistics(message.chat.id, "start")
    app.send_message(
        message.chat.id,
        f"Hi! Get LIKEs in groups and spend on anything.\n\nFor group owner: Add @MinterLikeBot to your group to get 10% of each transaction.",
        reply_markup=home_markup)
Exemple #10
0
def del_spam(client, a):
    print(a)
    tg_analytic.statistics(a.chat.id, "spam", ischat=True)
    threading.Thread(target=delete_message,
                     args=(a.chat.id, a.message_id, 0)).start()
Exemple #11
0
async def link_to_services(message: types.Message):
    tg_analytic.statistics(message.chat.id, message.text)
    await message.answer(
        '👉🏻 У нас пока не такой уж и большой спектр услуг, но в качестве имеющихся вариантов мы уверены:',
        reply_markup=services_menu)
Exemple #12
0
async def link_to_portfolio(message: types.Message):
    tg_analytic.statistics(message.chat.id, message.text)
    await message.answer('Что вас интересует?', reply_markup=portfolio_menu)
Exemple #13
0
async def link_to_prices(message: types.Message):
    tg_analytic.statistics(message.chat.id, message.text)
    await message.answer(
        '👉🏻 Для ознакомления с нашим прайслистом можешь перейти по ссылке:',
        reply_markup=price_menu)
Exemple #14
0
async def hello(message: types.Message):
    tg_analytic.statistics(message.chat.id, message.text)
    msg_text = """
Привет! я bot Rustle, для ознакомления с меню напишите /menu или же выберите нужный раздел 👇🏻
    """
    await bot.send_message(message.chat.id, msg_text, reply_markup=main_menu)
Exemple #15
0
def handle_text(message):
    tg_analytic.statistics(message.chat.id, message.text)
    bot.send_message(message.chat.id, 'Использована команда')
Exemple #16
0
def handle_text(message):
    tg_analytic.statistics(message.chat.id, message.text)
    bot.send_message(message.chat.id,
                     " Исполнена команда старт ",
                     reply_markup=user_markup)