discord-economy-easy
v1.1.3
Published
Economy module for your Discord Bot.
Downloads
28
Readme
Discord Economy Easy
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.