npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

terros-eco

v4.0.10

Published

a simple eco system

Downloads

22

Readme

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");