Untitled

mail@pastecode.io avatarunknown
plain_text
14 days ago
21 kB
0
Indexable
Never
const { Telegraf, Scenes, session } = require('telegraf');
const stage = new Scenes.Stage();
const express = require('express');
const app = express();
const bot = new Telegraf('6364012404:AAHx0GE4LnlHyPnhjLBF4q_g-9upzjto68k');
bot.use(session());
bot.use(stage.middleware());
let admin = 5626151907;

app.get('/', (req, res) => {
  res.send('Hello World!');
});
// FOR START CODE \\

bot.start(async ctx => {
  const userId = ctx.message.chat.id;
  const msg = ctx.message.text.split(" ");
  const firstName = ctx.message.chat.first_name;
  const lastName = ctx.message.chat.last_name;
  const userName = ctx.message.chat.username;
  let newUser = false;
  if (!newUser) {
    await ctx.telegram.sendMessage(admin, `
<b>➕ New User Joined the Bot</b> 

<b>👤 FirstName:</b> ${firstName}
<b>✍️ LastName:</b> ${lastName}
<b>👶 UserName:</b> @${userName}
<b>🆔 User Id:</b> <code>${userId}</code>
`, {
      parse_mode: 'HTML'
    });
    if (msg[1]) {
      let upline = msg[1];
      if (upline != undefined && upline != userId) {
        await ctx.telegram.sendMessage(upline, "➕* You Just Got a New Referral* " + userId, {
          parse_mode: 'markdown'
        });
      }
    }
  }
  await ctx.replyWithPhoto({
    url: "https://i.ibb.co/sCdFq91/IMG-1351.jpg"
  }, {
    caption: `
<b>👋 Hello </b>${firstName},

<b>🔥Welcome to TRON Games Bot🔥</b>

✨AUTO-PAYMENTS BOT✨

<i>This bot lets you earn Tron TRX by simples gaming.</i>

-> ✨ Lottery
-> 🎰 Bet
-> 🎲 Dice
-> ⚽️ Football
-> 🌀 Twister

<b>Minimum deposit:</b> 1 TRX

<i>👋 Please join our spot channel to continue more details and to continue to our Bot</i>
    `,
    parse_mode: "HTML",
    reply_markup: {
      inline_keyboard: [
        [
          { text: "🚀🚀 Join Our Channel 🚀🚀", url: "https://t.me/cartmoreelogs" }
        ],
        [
          { text: "✅ Continue to Bot", callback_data: "joinbot" }
        ]
      ]
    }
  });
});

// FOR MENU CODE \\

function mainMenu(ctx) {
  let userDetails;
  if (ctx.callbackQuery) {
    userDetails = ctx.callbackQuery.from;
  } else {
    userDetails = ctx.message.chat;
  }
  const userId = userDetails.id;
  let botName = ctx.botInfo.username;
  const firstName = userDetails.first_name;

  ctx.telegram.sendMessage(userId, `
<b>😎 Welcome To @${botName}
Join us now in making money and earn 10x your betting guaranteed.</b>
    
<i>🚀 Deposit now to get started</i>`, {
    reply_markup: {
      keyboard: [
        [
          { text: '👤 Account Information' }
        ],
        [
          { text: '📥 Add Funds' },
          { text: '🧮 Game Spot' },
          { text: '📤 Withdraw Funds' }
        ],
        [
          { text: '🎁 Free Bonus' },
          { text: '💼 Set wallet' },
          { text: '👨‍👨‍👧‍👦 Referral' }
        ],
        [
          { text: '❓ Help' },
          { text: '📄 Terms And Conditions' },
          { text: '📊 Statistics' }
        ]
      ],
      resize_keyboard: true
    },
    parse_mode: 'HTML'
  });
}
// FOR ACCOUNT BALANCE BUTTON \\

bot.hears('👤 Account Information', ctx => {
  const userId = ctx.message.chat.id;
  const name = ctx.message.chat.first_name;
  const balance = 0;

  ctx.reply(`
<b>Account Information

🤴 Name:</b>  ${name}
<b>🆔 Acct ID:</b> ${userId}
<b>💰 Balance:</b> ${balance} <b>TRX</b>

<i>🚀 Deposit now!!!</i>`, {
    parse_mode: 'HTML'
  });
});

// FOR HELP BUTTON \\

bot.hears('❓ Help', ctx => {
  const userId = ctx.message.chat.id;
  const firstName = ctx.message.chat.first_name;

  ctx.telegram.sendMessage(userId, `
1.) If You Want To Deposit Then Click On <b>📥 Add Funds</b>

2.) If You Want To Withdraw Then Click On <b>📤 Withdraw Funds</b>
    
3.) If you want to set a wallet address, click On <b>💼 Set wallet</b>
    
4.) To start playing and make a x10, click On <b>🧮 Game Spot</b>
    
5.) To receive free bonuses every day and earn more, Click On <b>🎁 Free Bonus</b>
    
6.) If you want to earn much more by inviting friends, Click On <b>👨‍👨‍👧‍👦 Referral</b>
    
7.) To know the statistics of the Bot, Click On <b>📊 Statistics</b>
    
8.) To know the account information, Click On <b>👤 Account Information</b>
    
8.) If you want to see our terms and conditions, Click On <b>📄 Terms And Conditions</b>
    
9.)Transparency with our community. Payments Channel: @TronGamesBotPayments
    
10.) For contacts and questions write to us at: 🚒<b>@DogeClick_ORG</b> or Visit our website: www.dogeclick.org - <b>Channel:</b> @DogeClickUpdatesNews
    `,{
    parse_mode: "HTML"
    });
});

// FOR REFERRAL BUTTON \\

bot.hears('👨‍👨‍👧‍👦 Referral', ctx => {
  const userId = ctx.message.chat.id;
  const botName = ctx.botInfo.username;
  const total = 0;

  ctx.telegram.sendMessage(userId, `
<b>🤑 Earn 0.025 Tron TRX for New referral

🔥 Your Total Downlines
      ${total} Downlines
    
✅ Ref Link to share link with your friends: https://t.me/${botName}?start=${userId}</b>`, {
    parse_mode: 'HTML'
  });
});

// FOR STATISTICS BUTTON \\

bot.hears('📊 Statistics', ctx => {
  const userId = ctx.message.chat.id;
  const botName = ctx.botInfo.username;
  // date
  const date = new Date();
  // total users,deposits and withdraws
  const totalUser = 0;
  const totalDeposits = 0;
  const totalWithdraws = 0;
  // lotteries
  const totalLotteryWins = 0;
  const totalLotteryLoss = 0;
  // total dices
  const totalDiceWins = 0;
  const totalDiceLoss = 0;
  // football stats
  const totalBallWins = 0;
  const totalBallLoss = 0;
  // twister totals
  const totalTwisterWins = 0;
  const totalTwisterLoss = 0;

  ctx.telegram.sendMessage(userId, `
🔥<u> Full Statics Of Bot </u>🔥

<b>⌛ Bot Uptime: 99.99%
📆 Date Time:</b><i> ${date}</i>

<b>👤 Total Users:</b> ${totalUser}
<b>📥 Total Deposits:</b> ${totalDeposits} TRX
<b>📤 Total Withdraws:</b>  ${totalWithdraws} TRX
<b>------------------------------------------------</b>
✨ <u>Total Lotteries</u>
🤑 Total Lotteries Winned : ${totalLotteryWins}
😥  Total Lotteries Losed : ${totalLotteryLoss}
<b>---------------------------</b>
🎲<u> Dice Stats</u>
🤑 Total Dice Winned : ${totalDiceWins}
😥  Total Dice Losed : ${totalDiceLoss}
<b>---------------------------</b>
⚽️<u> FootBall Stats</u>
🤑 Total FootBall Winned : ${totalBallWins}
😥  Total FootBall Losed : ${totalBallLoss}
<b>---------------------------</b>
🌀<u> Twister Stats</u>
🤑 Total Twister Winned : ${totalTwisterWins}
😥  Total Twister Losed : ${totalTwisterLoss}`, {
    parse_mode: "HTML"
});
});

// FOR TERMS AND CONDITIONS BUTTON \\

bot.hears('📄 Terms And Conditions', ctx => {
ctx.telegram.sendMessage(ctx.message.chat.id, `
<b>📄 <u>Terms And Conditions </u></b>

<b>📢 Games In This Maybe Be Addictive And Have Righ Risk Of Money Loss

Please Use It At Your Own Risk In Case Of Any Money Loss We Are Not Responsible.</b>
    
<i>To maintain our services, a 5% commission will be charged on all deposits and withdrawals.</i>`, {
    reply_markup: {
      inline_keyboard: [
        [
          {
            text: '✅ Verify', callback_data: 'verifyterms'
          },
          {
            text: '❌ Decline', callback_data: 'declineterms'
          }
        ]
      ]
    },
    parse_mode: "HTML"
  });
});

// FOR SET WALLET BUTTON \\

bot.hears('💼 Set wallet', ctx => {
  const chatId = ctx.message.chat.id;
  let wallet;
  if (!wallet) {
    wallet = '❌ Not set'
  }
  ctx.telegram.sendMessage(chatId, "⌛* Your Wallet:* `" + wallet + "`", {
    reply_markup: {
      inline_keyboard: [
        [
          { text: '⚙️ Set / Change Wallet', callback_data: "setwallet" }
        ]
      ]
    },
    parse_mode: 'markdown'
  });
});

// FOR BONUS BUTTON \\

bot.hears('🎁 Free Bonus', ctx => {
  function canRun() {
    var last_run_at = 1694142786854;
    if (!last_run_at) { return true }
    var minutes = (Date.now() - last_run_at) / 1000 / 60;
    var minutes_in_day = 48 * 60
    var next = minutes_in_day - minutes
    var wait_hours = Math.floor(next / 60)
    next -= wait_hours * 60
    var wait_minutes = Math.floor(next)
    var seconds = Math.floor((next - wait_minutes) * 60)
    if (minutes < minutes_in_day) {
      ctx.reply("*📛 You have already received a bonus Today\n\n▶️ Come Back After ⏳* " + wait_hours + " *h* " + wait_minutes + " *m* "
        + seconds + " *s*", {
        parse_mode: 'markdown'
      });
      return
    }
    return true;
  }
  if (!canRun()) { return }
  //save current time User.setProperty("last_run_at", Date.now(), "integer");
  ctx.reply("🎉 Congrats , you Received 0.25 TRX 🎊");
});

// FOR WITHDRAWAL BUTTON \\

bot.hears('📤 Withdraw Funds', ctx => {
  const balance = 2;
  const wallet =  "tffgggvv";
  const minimum = 1
  if (balance < minimum) {
    ctx.reply("_❌ You Need Minimum " + minimum + " TRX To Withdraw_", {
      parse_mode: 'Markdown'
    });
  } else if (wallet == undefined || !wallet) {
    ctx.reply("_❌ Wallet not set_", {
      parse_mode: 'Markdown'
    });
  } else {
    const withdraw = new Scenes.BaseScene("withdraw");
    withdraw.enter( ctx => {
      ctx.reply("_➡️ Send Trx Amount to Withdraw_", {
        parse_mode: 'markdown'
        });
    });
    withdraw.on('text', ctx => {
      ctx.scene.leave();
      ctx.reply("Wait Processing...");
      

    ////// Rest for withdrawal
    });
    stage.register(withdraw);
    ctx.scene.enter("withdraw");
  }
});

// FOR GAMES STORE BUTTON \\

bot.hears('🧮 Game Spot', ctx => {
  
  ctx.replyWithPhoto({
    url: "https://i.ibb.co/Bsf4kB4/IMG-1352.jpg"
  },{
    caption: "👋 <u>Welcome to our Game Center!</u>\n\n🎮 Here, you can enjoy a variety of exciting games to test your luck and skills.\n🚀 Dive into the thrill of our games, including Lottery, Dice, Football, and Twister.\n✈️ Get ready for hours of fun and the chance to win big prizes.\n\n<b>🔥 Let the games begin! </b>🔥",
    parse_mode: "HTML",
    reply_markup: {
      keyboard: [
        [
          {
            text: '✨ Lottery'
          },
          {
            text: '🎲 Dice'
          }
        ],
        [
          {
            text: '⚽ FootBall'
          },
          {
            text: '🌀 Twister'
          }
        ],
        [
          {
            text: 'Back to home ↩️'
          }
        ]
      ],
      resize_keyboard: true
    }
  });
});

// FOR BACK BUTTON ON GAME CENTER \\

bot.hears('Back to home ↩️', ctx => {
  mainMenu(ctx);
});

// FOR ALL GAMES BUTTON HERE \\

// ------> FOR LOTTERY BUTTON <------- \\
bot.hears('✨ Lottery', ctx => {
  let balance = parseFloat(2);
  const mini = 1;
  if (balance < mini){
    ctx.reply("_❌ To Participate In Lottery You Must Have "+mini+" TRX_.",{
      parse_mode: 'markdown'
    });
  }else{
    const lotteryAmount = new Scenes.BaseScene("lotteryAmount");
    lotteryAmount.enter( ctx => {
      ctx.reply("➡️ _Enter TRX Amount to Participate in the Lottery_.",{
      parse_mode: 'markdown'
    });
    });
    lotteryAmount.on('text', ctx => {
     const amount = parseFloat(ctx.message.text);
      if (isNaN(amount)){
        ctx.reply("_❌ Enter a Valid Amount_.",{
      parse_mode: 'markdown'
    });
      }else if (balance < amount){
        ctx.scene.leave();
    ctx.reply("_❌ You Do Not Have Enough Balance to Play_.",{
      parse_mode: 'markdown'
    });
  }else{
        ctx.scene.leave();
///////////// after amount validated asking for guess number////
        const lotteryReturn = amount*2;
        const lotteryGuess = new Scenes.BaseScene("lotteryGuess");
        
        lotteryGuess.enter( ctx => {
          ctx.reply("⚠* Lottery Amount:* "+amount+" _TRX_\n\n➡️ You Will Get "+lotteryReturn+" *TRX* If You Win\n🔥 _ Send 5 Digit Number From 1-5_.",{
      parse_mode: 'markdown'
    });
        });
        lotteryGuess.on('text', ctx => {
          const guessGame = ctx.message.text;

          if (isNaN(guessGame)){
            ctx.reply("_❌ Please Enter a Valid Numbers_.",{
      parse_mode: 'markdown'
    });
          }else if (guessGame.length > 5){
            ctx.reply("_❌ Please Enter a Number only 5 lengths_.",{
      parse_mode: 'markdown'
    });
          }else if (guessGame.includes("6")||guessGame.includes("7")||guessGame.includes("8")||guessGame.includes("9")||guessGame.includes("0")){
            ctx.reply("_❌ Please Enter a Number Only From 1 - 5_.",{
      parse_mode: 'markdown'
    });
          }else{
            ctx.scene.leave();
            balance -= amount;
            ctx.replyWithMarkdown("🪁 _Validating your Game ... 3s_");
            
            setTimeout(function (){
              ctx.replyWithMarkdown("_3_");
            },1000);
            
            setTimeout(function (){
              ctx.replyWithMarkdown("_2_")
            },2000);
            setTimeout(function (){
              ctx.replyWithMarkdown("_1_")
            },3000);
            setTimeout(function (){
let c = "";
let arr = ["1", "2", "3", "4", "5"];
let i;

function getRandomItem(arr) {
  var randomIndex = Math.floor(Math.random() * arr.length);
  var item = arr[randomIndex];
  return item;
}
for (i = 0; i < arr.length; i++) {
  var result = getRandomItem(arr);

  if (!c.includes(result)) { 
    c += result;
  } else {
    i = i - 1;
    continue;
  }
}
if (guessGame === c) { 
  ctx.reply("🎊 WoHoo You Win *"+lotteryReturn+"* TRX");
  balance += lotteryReturn;
} else {
  ctx.reply("😭* Opps*, It's "+c+", _You Lose_ *"+amount+"* _TRX_",{
    parse_mode: "markdown"
  });
}
            },4000);
          }
        });
        stage.register(lotteryGuess);
       ctx.scene.enter("lotteryGuess");   
/////// end of it \\\\\\\\\\\\\
      }
    });

    stage.register(lotteryAmount);
    ctx.scene.enter("lotteryAmount");

  }
});

// ------> FOR DICE BUTTON <------- \\

bot.hears('🎲 Dice', ctx => {
  let balance = 5;
  const mini = 3;
  const diceReturn = 5;
  const diceGame = new Scenes.BaseScene("diceGame");
  diceGame.enter( ctx => {
    ctx.telegram.sendMessage(ctx.chat.id,`
⚠ Note: *This game cost ${mini} trx to play and if you win you will get ${diceReturn} trx total else 😪*

🎲_ Enter a random number between 1 to 6 _🎲`, {
    parse_mode: 'markdown',
    reply_markup: {
      keyboard: [
        [
          {text: '1'},
          {text: '2'},
          {text: '3'}
        ],
        [
          {text: '4'},
          {text: '5'},
          {text: '6'}
        ],
        [
          {text: '🎲 Dice'},
          {text: 'Back to home ↩️'}
        ]
      ],
      resize_keyboard: true
    }
});
  });
  diceGame.on('text', ctx => {
    const guessDice = ctx.message.text;
    if (balance < mini){
      ctx.replyWithMarkdown("*📢 You have to own at least "+mini+" trx* ...\n_This game cost "+mini+" trx to play!_");
      ctx.scene.leave();
    }else if (guessDice > 0 && guessDice <= 6){
balance -= 3;
ctx.scene.leave();
const sentDice = new Scenes.BaseScene("sentDice");
      
sentDice.enter(async ctx => {
  await ctx.replyWithMarkdown("➡️ *Guides:* _Click on the below _*Dice (🎲) *_to send Your Dice_");
  ctx.sendDice();
});
sentDice.on('dice', ctx => {
  ctx.scene.leave();
  const result = ctx.message.dice.value;
ctx.replyWithMarkdown('_🪁 Validating your Dice Result_');

  setTimeout( function (){
    if (parseFloat(result) === parseFloat(guessDice)) {
  ctx.replyWithMarkdown('*🎁 Congratulations, you have received 5 TRX for winning*\n play again 😎');
  balance += 5;
} else {
   ctx.replyWithMarkdown('*🔸 Luck for the next!*');
  ctx.replyWithMarkdown('😪 *The correct number was ' + result + '*');
}
  },3000);
});
stage.register(sentDice);    
ctx.scene.enter("sentDice");   
    }else{
      ctx.replyWithMarkdown("*✨ This is a dice game.*\n▫️_Enter numbers 1 through 6 only._");
    }
  });

  stage.register(diceGame);
  ctx.scene.enter("diceGame");
});


// ------> FOR DICE BUTTON <------- \\


bot.hears('⚽ FootBall', ctx => {
    ctx.telegram.sendMessage(ctx.message.chat.id, `🌿 *Here you can play football and win more trx
🔥The rules are simple: 

 If Result == 6,4,2 You win 2 TRX
 If Result == 5,3,1 You will loose 1 Trx Bet*

_⚽ FootBall Game Play Price is Only 1 TRX Per Ball Played_`, {
      parse_mode: 'markdown',
      reply_markup: {
        inline_keyboard: [
          [
            {
              text: 'Play ⚽️', callback_data: 'startball'
            }
          ],
          [
            {
              text: 'Back to Home',callback_data: 'backtohome'
            }
          ]
        ]
      }
  });
});

// ------> FOR TWISTER BUTTON <------- \\

bot.hears('🌀 Twister', ctx => {
  ctx.telegram.sendMessage(ctx.chat.id, " 🌀 To win, Get a number higher than *5250* \n\n_Select amount to bet with_", {
    parse_mode: 'markdown',
    reply_markup: {
      inline_keyboard: [
        [
          {
            text: "🌀 1 TRX Twister",
            callback_data: "/lucky1"
          }
        ],
        [  
          {
            text: "🌀 2 TRX Twister",
            callback_data: "/lucky2"
          }
        ],
        [   
          {
            text: "🌀 5 TRX Twister",
            callback_data: "/lucky5"
          }
        ]
      ]
    }
  });
});

// ALL GAMES BUTTON FINISH THANK GOD \\

// ALL CALLBACK QUERIES \\

bot.on('callback_query', async ctx => {
  const userId = ctx.callbackQuery.from.id;
  const callback = ctx.callbackQuery.data;

  if (callback === "verifyterms") {
    ctx.answerCbQuery();
    ctx.editMessageText("*✅ Now You Can Use Bot Now*", {
      parse_mode: "markdown"
    });

  } else if (callback === "declineterms") {
    ctx.answerCbQuery();
    ctx.editMessageText("*❌ Some Permissions Declined*", {
      parse_mode: "markdown"
    });
  } else if (callback === "joinbot") {
    const member = await ctx.telegram.getChatMember("@cartmoreelogs", userId);
    if (member.status === "left") {
      ctx.answerCbQuery("⚠️ Please join the Channel");
    } else {
      ctx.answerCbQuery("🔥 Welcome to the Bot");
      await ctx.deleteMessage();
      mainMenu(ctx);
    }
  }else if (callback === "setwallet") {
    const walletScene = new Scenes.BaseScene("walletScene");
      walletScene.enter(ctx => {
      ctx.editMessageText(`
<b>📝 Enter your TRX wallet address below and it will be saved for all future withdrawals.</b>


<i>You can still change your wallet address later on.</i>`,{
        parse_mode: 'HTML'
});
});
    walletScene.on('text', ctx => {
      const msg = ctx.message.text;
      if (msg.startsWith("T") && msg.length > 30) {
      ctx.reply("*✅ TRX Address Set To:* `"+ctx.message.text+"`",{
        parse_mode: 'markdown',
        reply_to_message_id: ctx.message.message_id
      });
      ctx.scene.leave();
    }else{
      ctx.reply("⚠️ _Please Send a Valid TRX Address_", {
        parse_mode: 'markdown'
      });
 }
    });
    
  stage.register(walletScene);
  ctx.scene.enter('walletScene');
    
  }else if (callback === "startball"){
    ctx.answerCbQuery();
    let balance = 1;
    const mini = 1;
    if (balance < mini){
      ctx.editMessageText("*❌ Insufficient Balance*,_ You have only "+balance+" TRX_",{
        parse_mode: 'markdown'
      });
    }else{
      ctx.deleteMessage();
      const result = Math.floor(Math.random() * 6) +1;
      ctx.reply("⚽️");
      setTimeout(async function(){
        
       await ctx.reply("Game result: "+result);

if (result % 2 === 0) {
  
   ctx.reply("You won the game +2 TRX");
  balance += 2;
} else {
  balance -= 1;
  ctx.reply("You lost the game -1 TRX");
  return; 
}
      },1000);
    return}
  } else if (callback === "/lucky1" || callback === "/lucky2" || callback === "/lucky5"){
    ctx.answerCbQuery();
    let balance = 6;
    const wish = String(callback)[6];
    const amount = parseFloat(wish);
    if (balance < amount){
      
      ctx.editMessageText("*⚠️ Not Enough  Balance Please Fund Your Wallet*.\n\n_You Need Atleast "+amount+" TRX_.", {
        parse_mode: 'markdown'
      });
      
    }else{
      const min = 0;
      const max = 7190;
      const real = Math.floor(Math.random() * (max - min + 1)) + min;
      if (parseFloat(real) > parseFloat(5250)){
        ctx.editMessageText("✅ Number: *"+real+"* 🎉 _Congratulations  You Won and You received_ *"+amount+"* TRX 💵", {
          parse_mode: 'markdown'
        });
        balance += amount;
      }else{
        ctx.editMessageText("❌ "+real+" Is Less Than 5250\n🥵 You Lost *"+amount+" TRX*\n\n😊 _You Can Try Again To stand The chance To win More TRX_",{
          parse_mode: 'markdown'
        });
        balance -= amount;
      }
      
    }
  }else{
    ctx.deleteMessage();
    mainMenu(ctx);
}
});


// ALL STOP ALL THANKS TO GOD BOT BY @STARKNIL \\

/*app.post('/depo', (req, res) => {
  
});*/


const port = 3000;
app.listen(port, () => {
  console.log(`Server Running on Port: ${port}`);
});
bot.launch();