cashcord

1.0.0 • Public • Published

CASHCORD

cashcord

INTRODUCTION

cashcord is an epic discord economy handler!

Installation

npm install cashcord@latest

Features

Easy to use Shops Multi Guilded

Sample

Connecting to MongoDB

const cashcord = require('cashcord')

try {
    cashcord.connectURI('YOUR MONGODB URI')
    console.log('Connected to db!')
} catch(e) {
    console.log(e)
}

Creating a user

const cashcord = require('cashcord')

client.on('messageCreate', async (message) => {
    if (message.author.bot) return;
    if (message.content.startsWith('-create')) {
        try {
            await cashcord.CreateUser(message.author.id, message.guild.id)
            message.reply('Created an account for you! YAY!')
        } catch(e) {
            console.log(e)
            message.reply('Error occured :(')
        }
    }
})

Creating a simple shop

const { GuildShop } = require('cashcord')

const item = new GuildShop()
.setName('Berries')
.setPrice(100)
.setGuildId() // Your guild id goes here
.build()

Increasing balance

const cashcord = require('cashcord')

await cashcord.Increase('USER ID', 'GUILD ID', 10) // Note: the 10 is how much to increase

Decreaing balance

const cashcord = require('cashcord')

await cashcord.Decrease('USER ID', 'GUILD ID', 10) // Note: the 10 is how much to decrease

Withdrawing

NOTE: Withdrawing and Depositing will not happen if the user doesnt have enough amount of balance/bank

const cashcord = require('cashcord')

await cashcord.Withdraw('USER ID', 'GUILD ID', 10) // Note: the 10 is how much to withdraw 

Depositing

const cashcord = require('cashcord')

await cashcord.Deposit('USER ID', 'GUILD ID', 10) // Note: the 10 is how much to deposit

Get a user's data

const cashcord = require('cashcord')

const user = await cashcord.GetUser('USER ID', 'GUILD ID')

remove a user's data

const cashcord = require('cashcord')

try {
   await cashcord.RemoveUser('USER ID', 'GUILD ID')
} catch(e) {
    console.log(e)
}

Get the server leaderboard

const cashcord = require('cashcord')

const lb = await cashcord.GetLeaderboard(client, 'Guild Id', 10) // Note: replace the client with your discord.Client and the 10 is how much to retrive (eg: Top 10)

Get a user's rank

const cashcord = require('cashcord')

const rank = await cashcord.FetchPosition('USER ID', 'GUILD ID')

There are pretty much more to cover but hey thats the basics! Enjoy!

Package Sidebar

Install

npm i cashcord

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

20.7 kB

Total Files

20

Last publish

Collaborators

  • phantom_raja