1.1.3 • Published 11 months ago

discord-economy-easy v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Discord Economy Easy

npm npm

discord-economy-easy is a simple and efficient economy module designed for Discord bots. It allows developers to easily integrate a virtual currency system into their Discord bot.

Installation

To install the package, use npm:

npm install discord-economy-easy

Or with yarn:

yarn add discord-economy-easy

Usage

Here's a basic example of how to use discord-economy-easy in your Discord bot.

const { Client, GatewayIntentBits } = require('discord.js');
const { Balance, Daily } = require('discord-economy-easy'); 

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent
    ]
});

client.once('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

client.on('messageCreate', async message => {
    if (message.author.bot) return;

    const userId = message.author.id;

    if (message.content.startsWith('!balance')) {
        const balance = new Balance(userId);
        const userBalance = await balance.getBalance();
        message.reply(`Your current balance is ${userBalance} coins.`);
    }

    if (message.content.startsWith('!daily')) {
        const daily = new Daily(userId);

        const canClaim = await daily.canClaimDaily();

        if (canClaim) {
            await daily.setDailyClaim();
            const newBalance = await daily.addBalance(100);
            message.reply(`You have claimed your daily reward of 100 coins! Your new balance is ${newBalance} coins.`);
        } else {
            message.reply('You have already claimed your daily reward.');
        }
    }
});

client.login('DISCORD_BOT_TOKEN');

Contributing

Contributions are welcome! If you have ideas, suggestions, or found a bug, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

Special thanks to all the contributors who helped make this project better.

1.1.3

11 months ago

1.1.2

11 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago