Drag
commited on
Commit
·
e7ad4db
1
Parent(s):
7268842
Update bug.py
Browse files- Mikobot/plugins/bug.py +28 -15
Mikobot/plugins/bug.py
CHANGED
@@ -16,30 +16,43 @@ def bug_command_handler(client, message):
|
|
16 |
replied_message = message.reply_to_message
|
17 |
|
18 |
# Extract message content
|
19 |
-
content = replied_message.text or replied_message.caption
|
20 |
|
21 |
# Check if there is media content
|
22 |
media_type = (
|
23 |
-
"
|
24 |
-
if
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
else "**No media content included**"
|
30 |
)
|
31 |
|
32 |
-
#
|
33 |
-
|
34 |
|
35 |
-
#
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
)
|
|
|
|
|
|
|
|
|
39 |
else:
|
40 |
-
# If not a reply,
|
41 |
client.send_message(
|
42 |
message.chat.id,
|
43 |
-
"
|
44 |
parse_mode=ParseMode.MARKDOWN,
|
45 |
)
|
|
|
16 |
replied_message = message.reply_to_message
|
17 |
|
18 |
# Extract message content
|
19 |
+
content = replied_message.text or replied_message.caption or "No text provided"
|
20 |
|
21 |
# Check if there is media content
|
22 |
media_type = (
|
23 |
+
"Media content included"
|
24 |
+
if any(
|
25 |
+
[replied_message.photo, replied_message.document, replied_message.video,
|
26 |
+
replied_message.audio, replied_message.animation]
|
27 |
+
)
|
28 |
+
else "No media content included"
|
|
|
29 |
)
|
30 |
|
31 |
+
# Handle cases where username is unavailable
|
32 |
+
username = f"@{message.from_user.username}" if message.from_user.username else "an unknown user"
|
33 |
|
34 |
+
# Handle cases where message link is unavailable
|
35 |
+
message_link = (
|
36 |
+
f"[Link to message]({replied_message.link})"
|
37 |
+
if replied_message.link
|
38 |
+
else "**Message link unavailable**"
|
39 |
+
)
|
40 |
+
|
41 |
+
# Prepare the report message
|
42 |
+
report_message = (
|
43 |
+
f"Bug reported by {username}:**\n\n"
|
44 |
+
f"{content}\n\n"
|
45 |
+
f"{media_type}\n\n"
|
46 |
+
f"Message Link: {message_link}"
|
47 |
)
|
48 |
+
|
49 |
+
# Send the report message to all specified chat IDs
|
50 |
+
for chat_id in BUG_REPORT_CHAT_IDS:
|
51 |
+
client.send_message(chat_id, report_message, parse_mode=ParseMode.MARKDOWN)
|
52 |
else:
|
53 |
+
# If not a reply, prompt the user to reply with the command
|
54 |
client.send_message(
|
55 |
message.chat.id,
|
56 |
+
"Please reply to a message using the /bug command to report an issue.",
|
57 |
parse_mode=ParseMode.MARKDOWN,
|
58 |
)
|