4.0.10 • Published 2 years ago

terros-eco v4.0.10

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

A Discord.js v13 Module that allows you to Create an Basic Economy System for Your Discord Bot Easily.

NPM

Downloads

Features

  • 🌎 Seperate Cluster | You can use a cluster for your project and another mongodb cluster for your economy system.That means you can use more than 1 Cluster for your bot

  • ⚡️ Quick & Easy Setup | Its really easy to set up a economy system with this package!

  • 🔨 Utility Functions | Has Utility Functions to help in making a economy system

Install Package

Let's take a look at how you can install this package into your Discord Bot Project.

npm i terros-eco --save

Docs

Link

New Changes

  • 🔨 Utility Functions | Added utility functions like msToSeconds, secondsToMs, progressBar, profit, loss, randomNumber, cooldownSet, cooldownCheck.

Example Code

const { Client, Intents } = require("discord.js");
const terroseco = require("terros-eco");
const PREFIX = "!";
const client = new Client({
  intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});

client.on("ready", () => {
  console.log("Bot is Online");
});

client.eco = new terroseco.TerrosEco("UR BOTS ID", "YOUR MONGODB URI", {
  SpecialCoin: true, //enables the special coin system
});
const utils = new terroseco.Utility();
client.eco.connect(); //Connects the package to the mongodb cluster
client.eco.on("ready", () => {
  console.log("TerrosBot | Connected to DataBase!");
});

client.on("interactionCreate", async (i) => {
  if (i.isCommand()) {
    const { commandName } = i;
    if (commandName === "bal") {
      const wallet = await client.eco.wallet({ UserID: i.user.id });
      const bank = await client.eco.bank({ UserID: i.user.id });
      const bankSpace = await client.eco.bankSpace({
        UserID: i.user.id,
      });
      const SpecialCoin = await client.eco.specialCoin({
        UserID: i.user.id,
      });
      if (wallet || bank || bankSpace || SpecialCoin === "UNREGISTERED_USER")
        return i.reply({
          content: "you havent registered please register",
        });
      i.reply({
        content: `Wallet: ${wallet}\nBank: ${bank}/${bankSpace}\nTerrosCoins: ${SpecialCoin}`,
      });
    }
    if (commandName === "beg") {
      const add = await client.eco.add({
        UserID: i.user.id,
        Amount: utils.randomNumber({ min: 1, max: 100 }),
        Property: "Wallet",
      });
      if (add === "UNREGISTERED_USER")
        return i.reply({
          content: "you havent registered please register",
        });
      if (add === "DONE")
        return i.reply({
          content: "You have begged",
        });
    }
    if (commandName === "register") {
      const result = await client.eco.register({
        UserID: i.user.id,
        DefaultWallet: 0,
        DefaultBank: 0,
        DefaultBankSpace: 5000,
      });
      if (result === "REGISTERED")
        return i.reply({ content: "you have already registered" });
      if (result === "DONE")
        return i.reply({ content: `You have successfully registered` });
    }
  }
});

client.login("Discord Bot Token");
4.0.10

2 years ago

4.0.9

2 years ago

4.0.8

2 years ago

4.0.7

2 years ago

4.0.6

2 years ago

4.0.5

2 years ago

4.0.0

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.0

2 years ago