ShahriarAbidbd/SmartifyXBotPublic ยท Bot Template

Do Tasks Smartly with SmartifyX ๐Ÿ˜Ž

Utilitydownloaderyoutubeinstagramfacebookspoilercontent-protection
ProfileTelegram
25 commands2 envUpdated 1d agoCreated Jul 28, 2026
Back to folder

commands/_spoil.js

javascript ยท 116 lines

Raw
1/**#command2name: /spoil3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// If not replying to a message13if (!request.reply_to_message) {14  m = await msg.reply("โŒ Please reply to your own message and use /spoil");15  await m.react("๐Ÿ‘ป")16  return;17}18 19let r = request.reply_to_message;20if (r.from.id !== user.id) {21  m = await msg.reply("โŒ You can only use /spoil on a reply to your own message");22  m.react("๐Ÿ˜")23  return;24}25 26let name = user.first_name;27if (user.last_name) {28  name += " " + user.last_name;29}30 31let captionText = `<tg-spoiler>` + (r.caption ? r.caption + "\n\n" : "") + ` </tg-spoiler>` + `<blockquote><b>Requested by:</b> <a href="tg://user?id=${user.id}">${name}</a></blockquote>`;32 33 34let caption = "Requested by: " + name;35 36// Photo37if (r.photo) {38  Api.sendPhoto({39    chat_id: chat.id,40    photo: r.photo[r.photo.length - 1].file_id,41    caption: captionText,42    has_spoiler: true,43    parse_mode: "html"44  });45}46 47// File48else if (r.document) {49  Api.sendDocument({50    chat_id: chat.id,51    document: r.document.file_id,52    caption: captionText,53    parse_mode: "html"54 55  });56}57 58// Video59else if (r.video) {60  Api.sendVideo({61    chat_id: chat.id,62    video: r.video.file_id,63    caption: captionText,64    has_spoiler: true,65    parse_mode: "html"66  });67}68 69// GIF70else if (r.animation) {71  Api.sendAnimation({72    chat_id: chat.id,73    animation: r.animation.file_id,74    has_spoiler: true75  });76}77 78// Sticker79else if (r.sticker) {80  Api.sendSticker({81    chat_id: chat.id,82    sticker: r.sticker.file_id,83  });84}85 86// Text87else if (r.text) {88  Api.sendMessage({89    chat_id: chat.id,90    text: `<tg-spoiler>${request.reply_to_message.text}</tg-spoiler> \n\n<blockquote><b>Requested by:</b> <a href="tg://user?id=${user.id}">${name}</a></blockquote>`,91    parse_mode: "html"92  });93} else {94  m = await msg.reply("โŒ This type of content is not supported");95  await m.react("๐Ÿ˜ข")96  return;97}98 99// ===== DELETE PART =====100// Delete if permission allows, otherwise ignore101 102try {103  // Delete /p command104  Api.deleteMessage({105    chat_id: chat.id,106    message_id: msg.message_id107  });108 109  // Delete replied message110  Api.deleteMessage({111    chat_id: chat.id,112    message_id: r.message_id113  });114} catch (e) {115  // No permission โ†’ ignore116}