👋 Welcome to MK-GTP AI Bot
Your smart all-in-one assistant on Telegram! 🚀
Start with this link: https://t.me/MK_DEV_AI_BOT?start=1X7J4T
Your smart all-in-one assistant on Telegram! 🚀
Start with this link: https://t.me/MK_DEV_AI_BOT?start=1X7J4T
👍2🎉1
📢 New Features Added in MK-DEV AI Bot! 🚀
We’ve added some exciting new commands to make your experience even better:
🔗 /shorturl - Shorten a long URL into a compact link
📷 /qr - Generate a QR code from text or a URL
🌐 /ip - Show your public IP and the bot’s server IP
🛰 /ipinfo - Get detailed geolocation and ISP info of an IP address
📮 /pincode - Lookup postal information by PIN/ZIP code
💰 /gold - Check today’s Gold & Silver prices (using API)
⚡ All the previous features are still available!
👉 Start bot - @MK_DEV_AI_BOT
We’ve added some exciting new commands to make your experience even better:
🔗 /shorturl - Shorten a long URL into a compact link
📷 /qr - Generate a QR code from text or a URL
🌐 /ip - Show your public IP and the bot’s server IP
🛰 /ipinfo - Get detailed geolocation and ISP info of an IP address
📮 /pincode - Lookup postal information by PIN/ZIP code
💰 /gold - Check today’s Gold & Silver prices (using API)
⚡ All the previous features are still available!
👉 Start bot - @MK_DEV_AI_BOT
👍1😍1
chat_id = message.chat.id
msg = message.text.strip()
# Check if user only typed /ig without a URL
if msg.lower() == "/ig":
bot.sendMessage(
chat_id=chat_id,
text="❌ Please provide an Instagram Video URL like this:\n/ig https://instagram.com/p/ExampleVideo"
)
raise ReturnCommand()
# Remove command prefix
if msg.lower().startswith("/ig "):
msg = msg[4:].strip()
else:
bot.sendMessage(chat_id=chat_id, text="❌ Only Instagram links are supported.")
raise ReturnCommand()
# Validate Instagram URL
if not ("instagram.com" in msg or "instagr.am" in msg):
bot.sendMessage(chat_id=chat_id, text="❗ Please enter a valid Instagram URL.")
raise ReturnCommand()
# Show typing animation
bot.sendChatAction(chat_id=chat_id, action="typing")
bot.sendChatAction(chat_id=chat_id, action="typing")
# Encode URL and build API request
encoded_url = msg.replace(" ", "%20")
api_url = f"your_api_url={encoded_url}"
try:
response = HTTP.get(api_url, timeout=60, proxy=True)
# Handle API failure
if response.status_code != 200:
bot.sendMessage(
chat_id=chat_id,
text="⚠️ Sorry, we couldn't fetch the Instagram video. The service may be down or the URL is not supported."
)
raise ReturnCommand()
# Parse JSON safely
try:
data = response.json()
except:
bot.sendMessage(chat_id=chat_id, text="⚠️ Unable to process video information.")
raise ReturnCommand()
# Check for error from API
if data.get("error"):
bot.sendMessage(chat_id=chat_id, text="❌ Unable to fetch the video. Please check the link or try again later.")
raise ReturnCommand()
# Send video info
title = data.get("title", "Instagram Video")
thumbnail = data.get("thumbnail")
duration_sec = data.get("duration", 0)
duration_text = f"{duration_sec//60}m {duration_sec%60}s"
caption = f"🎬 {title}\n⏱ Duration: {duration_text}"
if thumbnail:
bot.sendPhoto(chat_id=chat_id, photo=thumbnail, caption=caption)
else:
bot.sendMessage(chat_id=chat_id, text=caption)
# Send videos as playable files
for media in data.get("medias", []):
quality = media.get("quality") or media.get("type") or "Video"
url = media.get("url")
bot.sendVideo(chat_id=chat_id, video=url, caption=f"{quality} Quality", supports_streaming=True)
except:
# Generic friendly error
bot.sendMessage(chat_id=chat_id, text="⚠️ Sorry, something went wrong while fetching the Instagram video. Please try again later.")
👍1