Goddy group9
1 subscriber
14 photos
7 links
Download Telegram
Forwarded from Goddy BJS
Link Detect on Group Chat

Command- *

// Function to check if a message contains a link
function containsLink(message) {
// Simple regex to detect URLs in the message
var urlPattern = /https?:\/\/[^\s]+/gi;
return urlPattern.test(message);
}

// Check if the incoming message contains a link
if (containsLink(message)) {
// Delete the message if it contains a link
Api.deleteMessage({
chat_id: chat.chatid, // the chat ID (group ID)
message_id: request.message_id // the message ID to delete
});

// Optionally, send a warning message to the group or user
Bot.sendMessage("Links are not allowed in this group. Your message has been deleted.");
}
Forwarded from Goddy BJS
User Name Change Notifier

Command- *

// Get the current name of the user
var currentName = user.first_name;

// Retrieve the stored name from the user properties
var storedName = User.getProperty("storedName");

// If the stored name exists and it's different from the current name, notify the group
if (storedName && storedName !== currentName) {
// Send a message to the group notifying about the name change
Bot.sendMessage("User " + user.telegramid + " changed their name from '" + storedName + "' to '" + currentName + "'.");

// Update the stored name with the new name
User.setProperty("storedName", currentName, "string");
} else if (!storedName) {
// If there's no stored name yet, store the current name for future comparisons
User.setProperty("storedName", currentName, "string");
}

// The rest of the bot functionality (e.g., sending a normal message)
Bot.sendMessage("Hello, " + currentName + "! Welcome to the group.");
Forwarded from Goddy BJS
Link Masking BJS

Command- /get
// Command to trigger the masking process
Bot.sendMessage("Send me the URL and the anchor text like this: \n\n /mask http://example.com YourAnchorText");


Command- /mask


var input = params;

if (!input || input.split(' ').length < 2) {
Bot.sendMessage("Please provide a valid URL and anchor text. Example: \n\n /mask http://example.com YourAnchorText");
return;
}

// Extract URL and anchor text from the input
var url = input.split(' ')[0];
var anchorText = input.split(' ').slice(1).join(' ');

// Create a masked link using Markdown
var maskedLink = "[" + anchorText + "](" + url + ")";

// Send the masked link
Bot.sendMessage("Here is your masked link: \n" + maskedLink);
Forwarded from Goddy BJS
Subscription Control BJS

Command- /activatepremium
var subscriptionDuration = 7 * 24 * 60 * 60 * 1000; // 7 days
var premiumStatus = User.getProperty("premiumStatus");
var premiumExpire = User.getProperty("premiumExpire");

if (premiumStatus && premiumExpire > Date.now()) {
Bot.sendMessage("You already have a premium subscription active until: " + new Date(premiumExpire).toLocaleString());
return;
}

User.setProperty("premiumStatus", true, "boolean");
var expireTime = Date.now() + subscriptionDuration;
User.setProperty("premiumExpire", expireTime, "integer");

Bot.sendMessage("Premium service activated! It will expire on: " + new Date(expireTime).toLocaleString());


Command- /checkpremium

var premiumExpire = User.getProperty("premiumExpire");

if (!premiumExpire || premiumExpire <= Date.now()) {
Bot.sendMessage("You do not have an active premium subscription.");
return;
}

var remainingTime = premiumExpire - Date.now();
var daysLeft = Math.floor(remainingTime / (24 * 60 * 60 * 1000));
var hoursLeft = Math.floor((remainingTime % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000));

Bot.sendMessage("Your premium subscription is active. Remaining time: " + daysLeft + " days, " + hoursLeft + " hours.");
Forwarded from Goddy BJS
🏳️‍🌈 Advanced Language Setting Code!

🐶 Command :
🇺🇸 Language

➡️ BJS :
const inlkey = [
[
{ text: "🇺🇸 English", callback_data: "/Set_lang EN" },
{ text: "🇪🇸 Español", callback_data: "/Set_lang ES" }
]
]
const text =
"*🇺🇸 Select The Language Of Your Preference.\n🇪🇸 Seleccione El Idioma De Su Preferencia.*"
Api.sendMessage({
text,
parse_mode: "Markdown",
reply_markup: { inline_keyboard: inlkey }
})


🐶 Command : /Set_lang

➡️ BJS : let msg_id = User.getProperty("Settings_Msg_ID")
let Data = params.split(" ")
let Set_Lenguage = Data[0]

if (Set_Lenguage.includes("EN")) {
User.setProperty("Lenguage", "EN", "string")
var Text = "*🇺🇸 Language Set To English.*"
}
if (Set_Lenguage.includes("ES")) {
User.setProperty("Lenguage", "ES", "string")
var Text = "*🇪🇸 Idioma Configurado En Español.*"
}
Api.sendMessage({ text: Text, parse_mode: "Markdown" })


🪤 Command : Anything

Example : Your current code is Api.sendMessage({ text: "❤️ Private", parse_mode: "Markdown" })
------------------------------------------------------

//Add This On First Every Code

if(User.getProperty("Lenguage")=="EN"){ //if language is EN

// Your Code
}

if(User.getProperty("Lenguage")=="ES"){ //if language is ES

//Your Translated Code
}



🪽 Example : if(User.getProperty("Lenguage")=="ES"){

Api.sendMessage({ text: "❤️ te amo", parse_mode: "Markdown" })
}

if(User.getProperty("Lenguage")=="EN"){

Api.sendMessage({ text: "❤️ I Love You", parse_mode: "Markdown" })
}

©️Copyright By @Private_Bots
Forwarded from Goddy BJS
Unrecognized command Handler

Command- *


let userInput = message;

let commands = ["/start", "/help", "/info"];//Add other commands your bot support

function isCommand(input) {
return commands.includes(input);
}

if (!isCommand(userInput)) {
Bot.sendMessage("Sorry, I didn't understand that. Please use a valid command.");
}
Forwarded from Goddy BJS
Secured Balance adder


Command - /add
Answer- Enter User id
Wait for answer- on

var key = "1399031414"//Edit your id
if (user.telegramid == key){
let msg = message;
User.setProperty("id", msg, "integer");
Bot.runCommand ("/bb");
}else{
return
}


Command- /bb
Answer- How much do you want to add
Wait for answer- on

var key = "1399031414"//Edit your id
if (user.telegramid == key){
let amount = parseFloat(message);
let tgid = User.getProperty("id");
let res = Libs.ResourcesLib.anotherUserRes("balance", tgid);
res.add(parseFloat(amount));
Bot.sendMessage("*Succesfully Added Balance* \n*👤 User = "+tgid+"\n💰 Amount= "+amount+"*");
}else{
return
}
Forwarded from Goddy BJS
Who need this code?
5 reactions and I would drop it❤️
Forwarded from Goddy BJS
Text To Image( Captcha ) BJs With Api

Command- /text
Answer- Send me your text
Wait for answer- on

BJS-
var userText = encodeURIComponent(message);  
var captchaUrl = "https://dummyimage.com/600x200/000/fff.png&text=" + userText;

Api.sendPhoto({
photo: captchaUrl,
chat_id: user.telegramid,
caption: "Here is your CAPTCHA!",
on_result: "onPhotoSent",
error: "onError"
});
Forwarded from Goddy BJS
5 reactions for this code✍️
Forwarded from Goddy BJS
Goddy BJS
Who need this code? 5 reactions and I would drop it❤️
Command- /add

Bjs-

Bot.sendMessage("Enter User IDs (comma separated)");

var key = "1399031414"; // Edit your id
if (user.telegramid == key) {
Bot.runCommand("/addbal2");
} else {
return;
}


Command- /addbal2
Wait for answer- on

let input = message;
let userIds = input.split(",").map(id => id.trim());
User.setProperty("userIds", userIds, "json");
Bot.sendMessage("How much do you want to add?");
Bot.runCommand("/bb");


Command- /bb
Wait for answer- on

var key = "1399031414"; // Edit your id
if (user.telegramid == key) {
let amount = parseFloat(message);
if (isNaN(amount)) {
Bot.sendMessage("Please enter a valid number for the amount.");
return;
}

let userIds = User.getProperty("userIds");
if (!userIds || userIds.length === 0) {
Bot.sendMessage("No user IDs found. Please run /add again.");
return;
}

userIds.forEach(function(tgid) {
let res = Libs.ResourcesLib.anotherUserRes("balance", tgid);
res.add(amount);
Bot.sendMessage("*Succesfully Added Balance* \n*👤 User = " + tgid + "\n💰 Amount= " + amount + "*");
});

User.setProperty("userIds", null);
} else {
return;
}
Forwarded from Goddy BJS
3 reactions for this✍️
Forwarded from Goddy BJS
Command - /age

Bjs-

var birthdate = new Date(params); // Birthdate provided by the user
if (isNaN(birthdate)) {
Bot.sendMessage("Please provide a valid birthdate in the format YYYY-MM-DD.");
return;
}

var today = new Date();
var age = today.getFullYear() - birthdate.getFullYear();
var monthDiff = today.getMonth() - birthdate.getMonth();

if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthdate.getDate())) {
age--;
}

Bot.sendMessage("You are " + age + " years old.");
Forwarded from Goddy BJS
Goddy BJS
5 reactions for this code✍️
Don’t forget this✍️
Forwarded from Goddy BJS
Command - Any Command


var commands = [
{ command: "/start", description: "Restart Bot" },
{
command: "/mainmenu",
description: "Redirect to Menu"
}
]

HTTP.post({
url: "https://api.telegram.org/bot" + bot.token + "/setMyCommands",
body: {
commands: commands,
scope: { 'type': "default" }
},
headers: { "Content-type": "application/json" }
})
Bot.sendMessage("Done")
Forwarded from Goddy BJS
Details- This code lists the group admins in a particular group

Bjs-

Command- /list

Api.getChatAdministrators({
chat_id: chat.chatid,
on_result: "/onAdminsReceived"
});


Command- /onAdminsReceived

var admins = options.result;
var adminList = "Group Administrators:\n";

for (var i = 0; i < admins.length; i++) {
var admin = admins[i].user;
adminList += "• " + admin.first_name;
if (admin.username) {
adminList += " (@" + admin.username + ")";
}
adminList += "\n";
}

Bot.sendMessage(adminList);
Forwarded from Goddy BJS
Name Detector Bjs

Command- *


var userId = user.telegramid;
var currentName = user.first_name;

var storedName = Bot.getProperty("name_" + userId);

if (storedName && storedName !== currentName) {
Bot.sendMessage("🔔 User " + userId + " has changed their name from '" + storedName + "' to '" + currentName + "'.");

Bot.setProperty("name_" + userId, currentName);
} else if (!storedName) {
Bot.setProperty("name_" + userId, currentName);
}
Forwarded from Goddy BJS
Command- Any Command


var telegramId = user.telegramid;
var firstName = user.first_name;
var lastName = user.last_name ? user.last_name : "N/A";
var username = user.username ? "@" + user.username : "N/A";
var languageCode = user.language_code ? user.language_code : "N/A";

var message = "🧑 *Your Telegram Account Information:*\n\n";
message += "👤 *Telegram ID*: `" + telegramId + "`\n";
message += "📛 *First Name*: " + firstName + "\n";
message += "📛 *Last Name*: " + lastName + "\n";
message += "👥 *Username*: " + username + "\n";
message += "🌐 *Language*: " + languageCode + "\n";

Bot.sendMessage(message, { parse_mode: "Markdown" });
Forwarded from Goddy BJS
Goddy BJS
5 reactions for this code✍️
Don’t forget this✍️