ShahriarAbidbd/SmartifyXBotPublic ยท Bot Template

Do Tasks Smartly with SmartifyX ๐Ÿ˜Ž

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

commands/_p.js

javascript ยท 124 lines

Raw
1/**#command2name: /p3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12 13if (chat.type === "private") return msg.reply("This command only works in Groups");14 15 16if (!request.reply_to_message) {17  m = await msg.reply("โŒ Please reply to your own message and use /p");18  await m.react("๐Ÿ˜")19  return;20}21 22let r = request.reply_to_message;23 24if (r.from.id !== user.id) {25  m = await msg.reply("โŒ You can only use /p on a reply to your own message");26  m.react("๐Ÿ˜")27  return;28}29 30let name = user.first_name;31if (user.last_name) {32  name += " " + user.last_name;33}34 35let captionText = (r.caption ? r.caption + "\n\n" : "") + `<blockquote><b>Requested by:</b> <a href="tg://user?id=${user.id}">${name}</a></blockquote>`;36 37 38let caption = "Requested by: " + name;39 40 41// Photo42if (r.photo) {43  Api.sendPhoto({44    chat_id: chat.id,45    photo: r.photo[r.photo.length - 1].file_id,46    caption: captionText,47    protect_content: true,48    parse_mode: "html"49  });50}51 52// File53else if (r.document) {54  Api.sendDocument({55    chat_id: chat.id,56    document: r.document.file_id,57    caption: captionText,58    protect_content: true,59    parse_mode: "html"60 61  });62}63 64// Video65else if (r.video) {66  Api.sendVideo({67    chat_id: chat.id,68    video: r.video.file_id,69    caption: captionText,70    protect_content: true,71    parse_mode: "html"72  });73}74 75// GIF76else if (r.animation) {77  Api.sendAnimation({78    chat_id: chat.id,79    animation: r.animation.file_id,80    protect_content: true81  });82}83 84// Sticker85else if (r.sticker) {86  Api.sendSticker({87    chat_id: chat.id,88    sticker: r.sticker.file_id,89    protect_content: true90  });91}92 93// Text94else if (r.text) {95  Api.sendMessage({96    chat_id: chat.id,97    text: request.reply_to_message.text + `\n\n<blockquote><b>Requested by:</b> <a href="tg://user?id=${user.id}">${name}</a></blockquote>`,98    protect_content: true,99    parse_mode: "html"100  });101} else {102 m = await msg.reply("โŒ This type of content is not supported");103  await m.react("๐Ÿ˜ข")104  return;105}106 107// ===== DELETE PART =====108// Delete if permission allows, otherwise ignore109 110try {111  // Delete /p command112  Api.deleteMessage({113    chat_id: chat.id,114    message_id: msg.message_id115  });116 117  // Delete replied message118  Api.deleteMessage({119    chat_id: chat.id,120    message_id: r.message_id121  });122} catch (e) {123  // No permission โ†’ ignore124}