#
#
#D3m02021-07-03 17:04:44
Python
#D3m0, 2021-07-03 17:04:44

Is there a converter from aiogram to telebot?

I found the game code for the bot
, but it is for aiograms, I don’t understand it and I can’t redo it myself ..

@dp.message_handler(regexp=r"(^Куб|куб) ?(\d+)? ?(\d+)?")
async def process_start_command(message: types.Message):
    stts = cur.execute("SELECT user_status from users where userid = ?", (message.from_user.id,)).fetchone()
    status = (stts[0])
    command_parse = re.compile(r"(^Куб|куб) ?(\d+)? ?(\d+)?")
    parsed = command_parse.match(message.text)
    dice_value = parsed.group(2)
    dice_value = int(dice_value)
    summ = parsed.group(3)
    summ = (summ)
    name1 = message.from_user.get_mention(as_html=True)
    
    if str(status) == 'Спонсор бота':
        if int(summ) <= int(275000000000):
            if dice_value > 6:
                await message.reply(f"<b>{name1}</b> введите сообщение в формате: \n<b>Куб (число от 1 до 6) (ставка)</b>", parse_mode='html')
            else:
                if not summ:
                    await message.reply(f"<b>{name1}</b> введите сообщение в формате: \n<b>Куб (число от 1 до 6) (ставка)</b>", parse_mode='html')
                else:
                    if not dice_value:
                        await message.reply(f"<b>{name1}</b> введите сообщение в формате: \n<b>Куб (число от 1 до 6) (ставка)</b>", parse_mode='html')
                    else:
                        balanc = cur.execute("SELECT balance from users where userid = ?", (message.from_user.id,)).fetchone()
                        balance = (balanc[0])
                        summ = int(summ)
                        if balance >= summ:

                            dice_value = int(dice_value)
                            bot_data = await bot.send_dice (message.chat.id)
                            bot_data = bot_data['dice']['value']
                            plus = bot_data + 1
                            minus = bot_data - 1
                            summ2 = summ * 10
                            data = {}
                            data["suma"] = summ
                            data['user_id'] = message.from_user.id
                            data1 = {}
                            data1["suma"] = summ2
                            data1['user_id'] = message.from_user.id
                            await sleep(5)

                            if bot_data > dice_value:
                                await message.reply( f'{name1} ты проиграл(а) <b>{summ}</b>', parse_mode='html')
                                cur.execute("""UPDATE users SET balance = balance - :suma WHERE userid = :user_id;""", data)

                            elif bot_data < dice_value:
                                await message.reply( f'{name1} ты проиграл(а) <b>{summ}</b>', parse_mode='html')
                                cur.execute("""UPDATE users SET balance = balance - :suma WHERE userid = :user_id;""", data)

                            else:
                                await message.reply( f'{name1} ты выиграл(а) <b>{summ2}</b>', parse_mode='html')
                                cur.execute("""UPDATE users SET balance = balance + :suma WHERE userid = :user_id;""", data1)
                            conn.commit()

                        elif balance < summ:
                            balanc = cur.execute("SELECT balance from users where userid = ?", (message.from_user.id,)).fetchone()
                            balance = (balanc[0])
                            await message.reply( f'{name1} у тебя нет столько \nТвой баланс:{balance} ', parse_mode='html')
        else:
            await message.reply( f'{name1} нельзя играть на сумы более <code>275000000000</code>', parse_mode='html')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2021-07-03
@deepblack

Is there a converter from aiogram to telebot?

Such a converter is called a developer.
On the subject of the question:
Open the documentation in the library, study (at the same time it is worth pulling up Python), rewrite (you can not rewrite, but continue writing with the newly mastered library)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question