coinsnitch
Version:
A lightweight Discord currency transfer detector for NovaGolds, LutexBits, and Credits.
186 lines (134 loc) โข 4.75 kB
Markdown

<div align="center">


</div>
# CoinSnitch
**CoinSnitch** is a smart currency transfer listener for Discord bots, supporting multiple virtual currencies like NovaGolds, LutexBits, and standard Credits. It detects transfers in real-time by monitoring Discord channels or message updates.
```
โจ Built for Discord.js v14 & v13
```
## ๐ฅ Features
- ๐ฑ Supports Multiple Currency Types
- ๐ Real-time Transfer Detection
- ๐ง Smart Filtering per Currency
- โ๏ธ Modular & Scalable Design
- ๐ฌ Works with `messageCreate` and `messageUpdate`
- ๐ Lightweight & Easy to Integrate
- ๐ Fully Customizable Filters
- ๐งช Fully Testable Functions
- ๐ Perfect for Economy Bots, Game Bots, and More
## ๐ฆ Installation
```bash
npm install coinsnitch
```
## ๐ก Usage Examples
### ๐ฏ `messageUpdate` Example โ `watchLutexBits`
```js
const { watchLutexBits } = require("coinsnitch");
client.on("messageCreate", async (message) => {
const options = {
client,
channel: message.channel,
userId: "USER_ID",
amount: [5, 10], // Supports multiple amounts
timeout: 60000
};
const result = await watchLutexBits(options);
if (result) {
await message.reply(`โ
Successfully transferred $${result.amount}!`);
} else {
await message.reply("โ Transfer failed or timed out.");
}
});
```
### ๐ฏ `messageCreate` Example โ `watchNovaGolds`
```js
const { watchNovaGolds } = require("coinsnitch");
client.on("messageCreate", async (message) => {
const options = {
channel: message.channel,
botId: "BOT_ID",
userId: "USER_ID",
amount: [5, 10, 20], // Pass single or multiple amounts
timeout: 60000
};
const result = await watchNovaGolds(options);
if (result) {
await message.reply(`๐ NovaGolds transfer of $${result.amount} confirmed!`);
} else {
await message.reply("โ No matching NovaGolds transfer detected.");
}
});
```
### ๐ฏ `messageCreate` Example โ `watchCredits`
```js
const { watchCredits } = require("coinsnitch");
client.on("messageCreate", async (message) => {
const options = {
channel: message.channel,
botId: "BOT_ID",
userId: "USER_ID",
amount: 10, // Can also be an array like [10, 20]
timeout: 60000
};
const result = await watchCredits(options);
if (result) {
await message.reply(`๐ฐ Credits transfer of $${result.amount} completed.`);
} else {
await message.reply("โ Credits transfer not found.");
}
});
```
## ๐ ๏ธ API Reference
Each watcher returns a Promise that resolves to an object or `false`.
### `watchNovaGolds(options)`
| Option | Type | Required | Description |
|-------------|------------------|----------|-------------|
| `channel` | Channel | โ
| The channel to monitor |
| `botId` | string | โ
| Bot ID expected to send the confirmation |
| `userId` | string | โ
| Target user ID receiving the transfer |
| `amount` | number \| number[]| โ
| Amount(s) to match |
| `timeout` | number | โ
| Timeout duration in milliseconds |
#### Returns:
```ts
Promise<{ message: Message, amount: number } | false>
```
### `watchCredits(options)` โ Same as above
### `watchLutexBits(options)` โ Monitors `messageUpdate` events instead of new messages.
## ๐ Folder Structure
```
coin-snitch/
โโโ filters/
โ โโโ creditsFilter.js
โ โโโ lutexBitsFilter.js
โ โโโ novaGoldsFilter.js
โโโ utils/
โ โโโ createMessageWatcher.js
โโโ watchers/
โ โโโ watchCredits.js
โ โโโ watchLutexBits.js
โ โโโ watchNovaGolds.js
โโโ index.js
โโโ package.json
```
## ๐ Supported Currencies
- **๐ฐ Credits**
- **๐ NovaGolds**
- **๐ง LutexBits**
- โ
Easily extendable for other types
## ๐ฌ Feedback & Support
If you have any feedback, ideas, or bugs to report:
- ๐ฌ [Join our Discord](https://dsc.gg/enexus)
## ๐ License
This project is licensed under the Apache License โ see the [`LICENSE`](./LICENSE) file for details.