# Commands

{% hint style="warning" %}
For this to work make sure to install [discord.js](https://www.npmjs.com/package/discord.js)
{% endhint %}

## Basic Setup

```javascript
const Discord = require('discord.js') //npm i discord.js
const client = new Discord.Client()
const prodigous = require('prodigous') //npm i prodigous
const prefix = "!"
client.on('ready', () => {
console.log(`logged in as ${client.user.username}`)
})
client.on('message', async(message) => {
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'commandName') {
message.channel.send("working")
}
})
client.login("TOKEN")
```

### Have a advance command handler?

The function all works the same way just import the package on every file where you want to use the package

## Command list

### Economy

{% hint style="danger" %}
Before using any of these methods do the following:
{% endhint %}

```javascript
await prodigous.connect("MONGO_DB_URI") //Put this at the bottom in index.js or your main file
```

#### Balance Command

```javascript
if(command === 'balance') {
let member = message.mentions.users.first() || message.author;
await prodigous.balanceCommand(message, member.id)
}
//Four lines
```

#### Reset all command

```javascript
if(command === "resetall") {
await prodigous.resetAll(message) //Resets all the currency to 0
} 
```

#### Leaderboard command

```javascript
if(command === 'leaderboard') {
await prodigous.leaderboardCommand(message, client)
}
```

#### Add money command

```javascript
if(command === 'add') {
let member = message.mentions.users.first()
if(!member) return message.channel.send("Invalid member")
if(!args[1]) return message.channel.send("Need a amount")
await prodigous.addCommand(member.id, args[1])
}
```

{% hint style="danger" %}
The following commands are still in **Beta**
{% endhint %}

**Blackjack command**

```javascript
if(command === 'blackjack') {
await prodigous.blackjackCommand(message)
}
```

## Voice Tracker

{% hint style="danger" %}
Before using any of these method do the following
{% endhint %}

```javascript
client.on('voiceStateUpdate', async(oldState, newState) => {
await prodigous.voiceStart(oldState, newState)
})
```

{% hint style="danger" %}
These methods are still in beta so use it at your own risk
{% endhint %}

#### Time command

```javascript
if(command === 'time') {
let member = message.mentions.users.first() || message.author;
await prodigous.timeCommand(member.id, message) //get user time spend in vc
}
```

#### Voice leaderboard command

```javascript
if(command === 'voice-lb') {
await prodigous.voiceLeaderboard(client, message)
}
```

#### More command coming soon...
