router = Router()
router.message.middleware(
CounterMiddleware
)
router = Router()
router.message.middleware(
CounterMiddleware()
)
async def list_orders(message):
cur.execute("SELECT * FROM orders WHERE userId=?", (message.from_user.id,))
users = cur.fetchall()
if users != list():
return await message.answer("Ничего нет")
text = '\n'.join([f'Order #{user[2}\nOpen!\n\n{user[3]}' for user in users])
return await message.answer(text=text)
@router.message(F.photo)
async def get_photo(message: types.Message):
await message.bot.download(file=message.photo[-1].file_id, destination=file_name)
if message.text == " Личный Кабинет":
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
item1 = types.KeyboardButton("Пополнить ")
item2 = types.KeyboardButton("Вывести")
item3 = types.KeyboardButton("Верификация")
item4 = types.KeyboardButton("Настройки")
markup.add(item1, item2, item3, item4)
bot.send_message(message.chat.id, ' Личный кабинет :\n'
'\n➖➖➖➖➖➖➖➖➖➖\n'
'\n Верификация: ❌\n'
'\n➖➖➖➖➖➖➖➖➖➖\n'
'\n Общий баланс: 0 \n'
'\n ID: 343538158\n'
'\n Пользователей онлайн:\n'
'\n➖➖➖➖➖➖➖➖➖➖\n'
'\nЗагруженность Bitcoin:\n'
'\nЗагруженность Ethereum:\n'
'\nЗагруженость Litecoin:'.format(message.from_user))
elif message.text == " Мои активы":
mute_hour = int(message.text[6:])
time_with_num = datetime.now() + timedelta(hours=mute_hour)
time_with_timestamp = time_with_num.timestamp()
real_time = time_with_num.strftime("%H:%M:%S")
await message.bot.restrict_chat_member(chat_id=message.chat.id,
user_id=message.reply_to_message.from_user.id,
until_date = time_with_timestamp,
permissions=types.ChatPermissions(can_send_messages=False)
)
@bot.callback_query_handler(func=lambda call: True)
def inside_button_click(call):
@bot.callback_query_handler(func=lambda call:True)
def handle_button_click(call):
@bot.callback_query_handler(func=lambda call: call.data == '4')
def inside_button_click(call):
bot.send_message(call.message.chat.id, f'мой текст')
https://steamcommunity.com/inventory/STEAMID/753/6?l=english&count=5000
from aiogram.filters.command import CommandObject, Command
@router.message(Command('test'))
async def test(message: types.Message, command: CommandObject):
print(command, command.args)
<pre><code class="language-python">Тут код "<"/code></pre>
Замените "<" на <.
```python
тут код
```
@router.message(F.text == "/lesmat")
async def lesmat(msg: Message):
await msg.answer_photo(FSInputFile("lesmat/lit1.png"))
@command(name="test")
async def test(self, message):
await self.HAOS(message)
from pyrogram.types import (InlineKeyboardMarkup, InlineKeyboardButton)
d_video['video_a'] = message.video.file_id
from aiogram import types
from aiogram.utils.keyboard import InlineKeyboardBuilder
builder = InlineKeyboardBuilder()
# 1 вариант (в строку)
builder.row(
types.InlineKeyboardButton(text, callback_data),
types.InlineKeyboardButton(text, callback_data)
)
# ---
# 2 вариант (в строку)
builder.button(text, callback_data)
builder.button(text, callback_data)
# ---
# 1 вариант (в столбец)
builder.row(
types.InlineKeyboardButton(text, callback_data),
types.InlineKeyboardButton(text, callback_data),
width=1
)
# ---
# 2 вариант (в столбец)
builder.button(text, callback_data)
builder.button(text, callback_data)
builder.adjust(1)
# ---
kb = [
[
types.InlineKeyboardButton(text, callback_data),
types.InlineKeyboardButton(text, callback_data)
],
[
types.InlineKeyboardButton(text, callback_data)
]
]
keyboard = types.InlineKeyboardMarkup(inline_keyboard=kb)
pip install aiogram==2.25.1