Advertisement
mosabric

Untitled

Apr 30th, 2025 (edited)
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.15 KB | None | 0 0
  1. @report.message(F.text.split("\n", 1)[0].lower() == '!репорт')
  2. async def reports(msg: Message):
  3.     user_id = msg.reply_to_message.from_user.id
  4.     user_username = msg.reply_to_message.from_user.username
  5.     user_name = msg.reply_to_message.from_user.first_name
  6.  
  7.     reported_id = msg.from_user.id
  8.     reported_username = msg.from_user.username
  9.     reported_name = msg.from_user.first_name
  10.     chat = msg.chat.id
  11.  
  12.     reason = msg.text.partition('\n')[2]
  13.     replaid = msg.reply_to_message
  14.  
  15.  
  16.  
  17.     if user_username:
  18.         user_link = f'<a href="https://t.me/{user_username}">{user_name}'
  19.     else:
  20.         user_link = f'<a href="tg://openmessage?user_id={user_id}">{user_name}'
  21.  
  22.     if reported_username:
  23.         reported_link = f'<a href="https://t.me/{reported_username}">{reported_name}'
  24.     else:
  25.         reported_link = f'<a href="tg://openmessage?user_id={reported_id}">{reported_name}'
  26.  
  27.     send_text = f"""#Репорты 🛑 Внимание! Новая жалоба.\n\nОт: {reported_link}\nНа: {user_link}"""
  28.  
  29.     if reason:
  30.         send_text += f'\n\nПричина: {reason}'
  31.     else:
  32.         send_text += f' '
  33.  
  34.     keyboard = types.InlineKeyboardMarkup(row_width=2)
  35.     button1 = types.InlineKeyboardButton(
  36.         text='🔗Перейти на сообщение',
  37.         url=f'https://t.me/c/{str(msg.reply_to_message.chat.id)[4:]}/{msg.reply_to_message.message_id}'
  38.     )
  39.     button2 = types.InlineKeyboardButton(
  40.         text='⛔️ Забанить', callback_data=f'ban_{user_id}_{msg.reply_to_message.message_id}_{msg.chat.id}'
  41.     )
  42.     button3 = types.InlineKeyboardButton(
  43.         text='🗑 Удалить', callback_data=f'del_{user_id}_{msg.reply_to_message.message_id}_{msg.chat.id}'
  44.     )
  45.     button4 = types.InlineKeyboardButton(
  46.         text='✅ Чек', callback_data=f'chek_{msg.message_id}'
  47.     )
  48.     button5 = types.InlineKeyboardButton(
  49.         text='➖ Игнор', callback_data=f'ignore_{msg.message_id}'
  50.     )
  51.     keyboard.row(button1)
  52.     keyboard.row(button2, button3)
  53.     keyboard.row(button4, button5)
  54.  
  55.     await bot.send_message(chat_id=chat, text = send_text, reply_markup=keyboard)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement