← back to browse
goat command

wingoMoney

Wingo betting game

0
views
0
likes
0
installs

Aliases: wingo, wg

raw source
module.exports = {
  config: {
    name: "wingoMoney",
    aliases: ["wingo", "wg"],
    version: "1.8.0",
    author: "Rahat Mahmud | Azadx69x",
    role: 0,
    category: "game",
    shortDescription: "Wingo betting game",
    usages: "wg daily | wg bet <amount> <red/green/big/small> | wg leaderboard"
  },

  onStart: async function ({ api, event, args, prefix, usersData }) {
    const userID = event.senderID;
    let user = await usersData.get(userID) || {};
    if (typeof user.money !== "number") user.money = 0;
    
    const styleText = (text) => {
      const bold = { 
        "A":"๐—”","B":"๐—•","C":"๐—–","D":"๐——","E":"๐—˜","F":"๐—™","G":"๐—š","H":"๐—›","I":"๐—œ","J":"๐—","K":"๐—ž","L":"๐—Ÿ","M":"๐— ",
        "N":"๐—ก","O":"๐—ข","P":"๐—ฃ","Q":"๐—ค","R":"๐—ฅ","S":"๐—ฆ","T":"๐—ง","U":"๐—จ","V":"๐—ฉ","W":"๐—ช","X":"๐—ซ","Y":"๐—ฌ","Z":"๐—ญ",
        "a":"๐—ฎ","b":"๐—ฏ","c":"๐—ฐ","d":"๐—ฑ","e":"๐—ฒ","f":"๐—ณ","g":"๐—ด","h":"๐—ต","i":"๐—ถ","j":"๐—ท","k":"๐—ธ","l":"๐—น","m":"๐—บ",
        "n":"๐—ป","o":"๐—ผ","p":"๐—ฝ","q":"๐—พ","r":"๐—ฟ","s":"๐˜€","t":"๐˜","u":"๐˜‚","v":"๐˜ƒ","w":"๐˜„","x":"๐˜…","y":"๐˜†","z":"๐˜‡",
        "0":"๐Ÿฌ","1":"๐Ÿญ","2":"๐Ÿฎ","3":"๐Ÿฏ","4":"๐Ÿฐ","5":"๐Ÿฑ","6":"๐Ÿฒ","7":"๐Ÿณ","8":"๐Ÿด","9":"๐Ÿต",
        ".":"โˆ™","$":"$"
      };
      return text.split("").map(c => bold[c] || c).join("");
    };
    
    const formatMoney = (n) => {
      let str;
      if (n >= 1_000_000) str = (n / 1_000_000).toFixed(2) + "M$";
      else if (n >= 1_000) str = (n / 1_000).toFixed(2) + "K$";
      else str = n + "$";
      return styleText(str);
    };
    
    if (args[0] === "daily") {
      if (Date.now() - (user.lastDaily || 0) < 86400000)
        return api.sendMessage(styleText("โณ Daily already claimed!"), event.threadID);

      user.money += 100;
      user.lastDaily = Date.now();
      await usersData.set(userID, user);

      return api.sendMessage(
        styleText(`๐ŸŽ Daily Reward: +100$\n๐Ÿ’ณ Balance: ${formatMoney(user.money)} (${styleText(user.money+"$")})`),
        event.threadID
      );
    }
    
    if (args[0] === "leaderboard") {
      const all = await usersData.getAll();
      const list = all
        .filter(u => typeof u.data?.money === "number")
        .sort((a, b) => b.data.money - a.data.money)
        .slice(0, 10);

      let msg = styleText("๐Ÿ† Wingo Leaderboard ๐Ÿ†\n\n");
      list.forEach((u, i) => {
        msg += styleText(`${i + 1}. ${u.userID} โ†’ ${formatMoney(u.data.money)}\n`);
      });

      return api.sendMessage(msg, event.threadID);
    }
    
    if (args[0] === "bet") {
      const amount = Number(args[1]);
      const option = args[2];

      if (!amount || amount <= 0)
        return api.sendMessage(
          styleText(`โŒ Invalid amount!\nUsage: ${prefix}wg bet <amount> <red/green/big/small>`),
          event.threadID
        );

      if (!["red", "green", "big", "small"].includes(option))
        return api.sendMessage(styleText("โŒ Invalid option!"), event.threadID);

      if (user.money < amount)
        return api.sendMessage(
          styleText(`โŒ Not enough balance!\n๐Ÿ’ณ Balance: ${formatMoney(user.money)}`),
          event.threadID
        );

      user.money -= amount;
      await usersData.set(userID, user);

      api.sendMessage(styleText("๐ŸŽฐ Wingo started...\nโณ Wait 5 seconds"), event.threadID, async (err, info) => {
        if (err) return;

        setTimeout(async () => {
          const num = Math.floor(Math.random() * 10);
          const color =
            [1, 3, 7, 9].includes(num) ? "RED" :
            [2, 4, 6, 8].includes(num) ? "GREEN" : "VIOLET";
          const size = num >= 5 ? "BIG" : "SMALL";

          let resultMsg = styleText("โ”โ”โ”โ”โ”โ”๐ŸŽฏ Result โ”โ”โ”โ”โ”โ”“\n");
          resultMsg += styleText(`โ”ƒ ๐Ÿ”ข Number: ${num}\n`);
          resultMsg += styleText(`โ”ƒ ๐ŸŽจ Color: ${color}\n`);
          resultMsg += styleText(`โ”ƒ ๐Ÿ“ Size: ${size}\n`);
          resultMsg += styleText("โ”ƒ\n");

          const win = option === color.toLowerCase() || option === size.toLowerCase();
          if (win) {
            user.money += amount * 2;
            resultMsg += styleText(`โ”ƒ ๐ŸŽ‰ You Win! ${amount}\n`);
            resultMsg += styleText(`โ”ƒ ๐Ÿ’ณ Balance: ${formatMoney(user.money)} (${user.money}$)\n`);
          } else {
            resultMsg += styleText(`โ”ƒ ๐Ÿ˜ข You Lose! ${amount}\n`);
            resultMsg += styleText(`โ”ƒ ๐Ÿ’ณ Balance: ${formatMoney(user.money)} (${user.money}$)\n`);
          }

          resultMsg += styleText("โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›");

          await usersData.set(userID, user);
          api.editMessage(resultMsg, info.messageID, event.threadID);
        }, 5000);
      });

      return;
    }
    
    return api.sendMessage(
      styleText(
        `๐ŸŽฐ Wingo Menu\n\n` +
        `${prefix}wg daily\n` +
        `${prefix}wg bet <amount> <red/green/big/small>\n` +
        `${prefix}wg leaderboard`
      ),
      event.threadID
    );
  }
};

View raw file