Bot Nations πŸš€
17.1K subscribers
18 photos
1 video
3 files
53 links
πŸ–πŸ» Welcome to β€œBot Nations”!

πŸ€– Hello, Everyone! Here, I’ll Teach You How To Create Telegram Bots.

➑ Join Our Discussion Group: @Private_Bots_Chats

πŸ“ž For Sponsorships, Ads, or Promotions, Contact Us At @PB_Sponsorship.
Download Telegram
πŸ“ Multiple File Sharing Telegram Bot [TELEBOT CODES]


❀️‍πŸ”₯ Command: /start 
πŸ” TPY:
if not params or params == "None":
bot.sendMessage(
text=(
"<b>πŸ“€ Welcome to Multi File Sharing Bot!</b>\n\n"
"With this bot, you can:\n"
"β€’ Upload <b>multiple photos, videos, documents, stickers, audios, voices, animations</b>.\n"
"β€’ Get a <b>unique shareable link</b> for your uploaded files.\n"
"β€’ Share that link anywhere, and anyone can open it to view/download your files.\n\n"
"⚑ <b>How to use:</b>\n"
"1. Type <code>/upload</code> to start an upload session.\n"
"2. Send all your media files one by one.\n"
"3. When finished, type βœ… to confirm upload.\n"
"4. You will get a shareable link to your uploaded files.\n\n"
"⏳ Files shared in chat are <b>auto-deleted after 10 minutes</b> to prevent spam.\n"
"But don’t worry β€” you can always restore them using the shareable link.\n\n"
"πŸš€ Start sharing your files now!"
),
parse_mode="html",
reply_markup={
"inline_keyboard": [[
{"text": "πŸ“€ Start Uploading", "callback_data": "/upload"}
]]
}
)
else:
media_id = params
files = Bot.getData(media_id)

if not files:
bot.sendMessage("❌ No media found for this link.")
else:
sent_msgs = [] # store message IDs for later deletion

# Send all media
for f in files:
m = None
if f["type"] == "photo":
m = bot.sendPhoto(f["file_id"], caption=f.get("caption", ""))
elif f["type"] == "video":
m = bot.sendVideo(f["file_id"], caption=f.get("caption", ""))
elif f["type"] == "audio":
m = bot.sendAudio(f["file_id"])
elif f["type"] == "voice":
m = bot.sendVoice(f["file_id"])
elif f["type"] == "document":
m = bot.sendDocument(f["file_id"])
elif f["type"] == "animation":
m = bot.sendAnimation(f["file_id"])
elif f["type"] == "sticker":
m = bot.sendSticker(f["file_id"])

if m and "message_id" in m:
sent_msgs.append(m["message_id"])

# Final note
note = bot.sendMessage(
"⚠️ <b>Note:</b> Files will be automatically deleted from chat after <b>10 minutes</b> to prevent spam.",
parse_mode="html",
reply_markup={
"inline_keyboard": [[
{"text": "πŸ”— Join Channel", "url": "t.me/botnations"}
]]
}
)
if "message_id" in note:
sent_msgs.append(note["message_id"])

# Schedule deletion of messages only
Bot.runCommandAfter(
600,
"/delete_messages",
options={"user_id": message.chat.id, "message_ids": sent_msgs, "media_id": media_id}
)


❀️‍πŸ”₯ Command: /upload
πŸ” TPY:
# /upload command
keyboard = ReplyKeyboardMarkup(True)
keyboard.row("βœ…")
media_id = Bot.genId() # generate a unique ID
bot.sendMessage(chat_id=message.chat.id, text="πŸ‘‰ Send me the text you want to upload. When you are done.",reply_markup = keyboard)
Bot.handleNextCommand("/handle_media", options={"media_id": media_id, "files": []}) # initialize files as an empty list

❀️‍πŸ”₯ Command: /handle_media
πŸ” TPY:
❀14πŸ‘4🀩2πŸ‘Œ1
media_id = options.get("media_id")
files = options.get("files", [])
keyboard = ReplyKeyboardRemove()

if message.text == "βœ…":
# Confirmation Logic
if files:
shareable_link = f"https://t.me/{Bot.info().username}?start={media_id}"

bot.sendMessage(
chat_id=message.chat.id,
text=f"βœ… Upload complete!\nShare this link:\n{shareable_link}",
reply_markup=keyboard
)
Bot.saveData(media_id, files) # Save to DB
else:
bot.sendMessage(chat_id=message.chat.id, text="❌ No media was uploaded.")

else:
media_entry = None

if message.photo:
media_entry = {"type": "photo", "file_id": message.photo[-1]["file_id"], "caption": message.caption or ""}
elif message.video:
media_entry = {"type": "video", "file_id": message.video["file_id"], "caption": message.caption or ""}
elif message.audio:
media_entry = {"type": "audio", "file_id": message.audio["file_id"]}
elif message.voice:
media_entry = {"type": "voice", "file_id": message.voice["file_id"]}
elif message.document:
media_entry = {"type": "document", "file_id": message.document["file_id"]}
elif message.animation:
media_entry = {"type": "animation", "file_id": message.animation["file_id"]}
elif message.sticker:
media_entry = {"type": "sticker", "file_id": message.sticker["file_id"]}

if media_entry:
files.append(media_entry)
bot.sendMessage(chat_id=message.chat.id, text="βœ… Media saved. Send more or type βœ… to finish.")
else:
bot.sendMessage(chat_id=message.chat.id, text="❌ Unsupported input. Please send media files only.")

# Loop until user confirms
Bot.handleNextCommand("/handle_media", options={"media_id": media_id, "files": files})

❀️‍πŸ”₯ Command: /delete_messages
πŸ” TPY:
user_id = options.get("user_id")
msg_ids = options.get("message_ids", [])
media_id = options.get("media_id")

# Delete all sent messages
for mid in msg_ids:
try:
bot.deleteMessage(chat_id=user_id, message_id=mid)
except Exception:
pass

# Notify user with restore option
Bot.sendMessage(
chat_id=user_id,
text="πŸ—‘οΈ Your files have been deleted from chat after 10 minutes.\nClick below to restore them.",
reply_markup={
"inline_keyboard": [[
{"text": "πŸ”„ Restore Files", "url": f"https://t.me/{Bot.info().username}?start={media_id}"}
]]
}
)

πŸ‘¨β€πŸ’» Created By: @Swastik_Raj
Β© Copyright:
@BotNations 
πŸ“’ Feel free to share and give credit if you use this in your
channel!
❀14πŸ‘4πŸŽ‰2πŸ₯°1
πŸš€ Introducing Code Formatter – Your Go-To Solution for Clean Code!

✨ Supports Python, JS, Ruby, C#, and more 
🎨 Custom themes & beginner-friendly interface 
πŸ”’ Private, secure, and lightning-fast

🌐 Visit Us Now: https://code-formating.vercel.app 
πŸ“£ Love it? Share it with your friends and colleagues!
❀8πŸ’―3πŸ‘2
πŸ›‘οΈ Channel Membership Verification Bot [TELEBOT CODES]
πŸ“Œ Purpose: Check if a user has joined required channels.

❀️‍πŸ”₯ Command: /verify
πŸ” TPY:
# Command: /verify

try:
# Define your channels here (can be 1 or more)
channels = ["@botnations", "-1001687277105"]
bot_token = str(Bot.info().token)

# Send "checking..." message and save message_id for later editing
checking = bot.sendMessage("πŸ” Checking your channel membership status, please wait...")

# Build the API URL dynamically using the channels list
api_url = f"https://channel-membership.privates-bots.workers.dev/?botToken={bot_token}&id={u}&channel={','.join(channels)}"

# Make HTTP request
response = HTTP.get(api_url)
data = bunchify(response.json())

# Prepare message content
if data.ok == True:
summary = data.summary
joined = summary.totalJoined
total = summary.totalChannelsChecked
left = summary.totalLeft

text = f"<b>πŸ“Š Membership Summary</b>\n\n"
text += f"πŸ‘€ User ID: <code>{u}</code>\n"
text += f"βœ… Joined: <b>{joined}</b> / {total}\n"
text += f"🚫 Left: <b>{left}</b>\n\n"
text += "<b>πŸ“¦ Detailed Status:</b>\n"

for ch in data.membership:
status_emoji = "βœ…" if ch.isMember else "❌"
text += f"{status_emoji} <b>{ch.chatId}</b> - {ch.classification}\n"

if data.joinedAllChats == True:
text += "\nπŸŽ‰ You have joined all required channels!"
else:
text += "\n⚠️ Please join all required channels to continue."

# Edit previous message with the result
bot.editMessageText(text=text, chat_id=message.chat.id, message_id=checking.message_id, parse_mode="html")
else:
bot.editMessageText(text="❌ Failed to verify membership. Please try again later.", chat_id=message.chat.id, message_id=checking.message_id)

except Exception as e:
bot.editMessageText(text=f"⚠️ Error occurred: {str(e)}", chat_id=message.chat.id, message_id=checking.message_id)

⚠️ Give credit if you are posting on your channel.
πŸ‘¨β€πŸ’» Created By:
@swastik_raj
Β© Credit:
@botnations
❀13❀‍πŸ”₯2πŸ‘2πŸ”₯2
1❀8🀩2⚑1πŸŽ‰1
I am thinking of starting to do some videos to help people who want to legitimately be able to codeβ€” most seems like copy paste without any knowledge about the concept.
3❀15🀩5
πŸ›‘ Handling β€œMessage too long” Error

✏️ Telegram allows sending a Text message of max 4096 characters by bot

πŸ’‘ Send Message in multiple messages chunks.

Here is the BJS code to do that:
let chatId = chat.chatid; // Replace with chat id
let message = 'Long Message to send…'; // Replace with the long message

// Function to split a long message into smaller pieces/chunks
function splitMessage(message, maxLength = 4096) {
  let chunks = []

  // Split the message in multiple chunks each of max 4096 characters
  for (let i = 0; i < message.length; i += maxLength) {
    chunks.push(message.substring(i, Math.min(message.length, i + maxLength)))
  }

  return chunks;
}

// Function to send a long message in smaller pieces
function sendMessageInChunks(chatId, text) {
  // split the message into chunks
  var chunks = splitMessage(text)

  // Send the pieces of chunks one after other
  for (let i = 0; i < chunks.length; i++) {
    Api.sendMessage({ chat_id: chatId, text: chunks[i] })
  }
}

// Send the message in pieces
sendMessageInChunks(chatId, message)

πŸ§‘β€πŸ’» Coded by: @devendra
Β©  Copyright
: @BjsCodes
❗️ Only use in state of high requirement, else BB server may get load.
❀9πŸ‘1πŸŽ‰1
Want this bot tutorial?

@PerplexitySRoBot
❀6πŸ”₯3
Bot Nations πŸš€
Want this bot tutorial? @PerplexitySRoBot
Real time information!

Text to video
Image Editing & much more
❀9πŸ”₯6πŸ‘3
Complete 450+ subscribers for the code!

YouTube link:
youtube.com/@privates_bots
❀121πŸ”₯4πŸ†’3
@MusicDownloadKBot active again βœ…
πŸ‘Œ4❀2
Bot Nations πŸš€
https://youtu.be/qT367lglThQ
You can clone the @PerplexitySRoBot from the above video!
❀8πŸŽ‰2
Order affordable custom bot
Cheapest price ever!

Dm @coderswastik or comment below
❀8🀩1
πŸ‘‹πŸΌ Hello BotMakers!

I’m working on my next YouTube videoβ€”and it’s all about how you can start earning $50–$100/month by monetizing your Telegram bot πŸ’°

Stay tunedβ€”and don’t forget to subscribe so you don’t miss it! πŸ””πŸŽ₯
❀15⚑4πŸ”₯4πŸŽ‰2πŸ†’2❀‍πŸ”₯1πŸ‘1
Bot Nations πŸš€
Here's the video https://youtu.be/m9INAwGkbPI
Hit the like button πŸ‘πŸΌ

Nd leave a comment 🫢🏼
❀11πŸ₯°4
πŸ”₯8❀5