|
from pyrogram import filters |
|
from pyrogram.enums import ParseMode |
|
|
|
|
|
BUG_REPORT_CHAT_IDS = [-1002287972008] |
|
|
|
from Mikobot import app |
|
|
|
|
|
|
|
@app.on_message(filters.command("bug", prefixes="/")) |
|
def bug_command_handler(client, message): |
|
|
|
if message.reply_to_message: |
|
|
|
replied_message = message.reply_to_message |
|
|
|
|
|
content = replied_message.text or replied_message.caption or "No text provided" |
|
|
|
|
|
media_type = ( |
|
"Media content included" |
|
if any( |
|
[replied_message.photo, replied_message.document, replied_message.video, |
|
replied_message.audio, replied_message.animation] |
|
) |
|
else "No media content included" |
|
) |
|
|
|
|
|
username = f"@{message.from_user.username}" if message.from_user.username else "an unknown user" |
|
|
|
|
|
message_link = ( |
|
f"[Link to message]({replied_message.link})" |
|
if replied_message.link |
|
else "**Message link unavailable**" |
|
) |
|
|
|
|
|
report_message = ( |
|
f"Bug reported by {username}:**\n\n" |
|
f"{content}\n\n" |
|
f"{media_type}\n\n" |
|
f"Message Link: {message_link}" |
|
) |
|
|
|
|
|
for chat_id in BUG_REPORT_CHAT_IDS: |
|
client.send_message(chat_id, report_message, parse_mode=ParseMode.MARKDOWN) |
|
else: |
|
|
|
client.send_message( |
|
message.chat.id, |
|
"Please reply to a message using the /bug command to report an issue.", |
|
parse_mode=ParseMode.MARKDOWN, |
|
) |
|
|