-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5014b6
commit b57e3af
Showing
1 changed file
with
42 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,42 @@ | ||
const xpperbank = 1 | ||
let handler = async (m, { conn, command, args }) => { | ||
let count = command.replace(/^(dep|deposit)$/i, '') | ||
count = count ? /depall/i.test(count) ? Math.floor(global.db.data.users[m.sender].credit / xpperbank) : parseInt(count) : args[0] ? parseInt(args[0]) : 1 | ||
count = Math.max(1, count) | ||
if (global.db.data.users[m.sender].credit >= xpperbank * count) { | ||
global.db.data.users[m.sender].credit -= xpperbank * count | ||
global.db.data.users[m.sender].bank += count | ||
conn.reply(m.chat, `Te Transferiste 🪙 ${count} oro a tu banco`, m) | ||
} else conn.reply(m.chat, `🟥 *No tienes suficiente cantidad de oro en tu billetera para realizar esta transacción*`, m) | ||
} | ||
handler.help = ['deposit'] | ||
handler.tags = ['economy'] | ||
handler.command = ['deposit', 'dep', 'depall','depositar'] | ||
|
||
handler.disabled = false | ||
|
||
export default handler | ||
import axios from 'axios'; | ||
|
||
let handler = async (m, { conn, usedPrefix, args }) => { | ||
let user = global.db.data.users[m.sender]; | ||
let depositAmount = args[0] ? parseInt(args[0]) : 0; | ||
|
||
if (isNaN(depositAmount) || depositAmount < 1) | ||
throw 'Por favor, introduce una cantidad válida de oro para depositar. Ejemplo: .depositar 100'; | ||
|
||
if (user.credit < depositAmount) | ||
throw 'No tienes suficiente oro para realizar este depósito.'; | ||
|
||
user.bank += depositAmount; | ||
user.credit -= depositAmount; | ||
|
||
let message = ` | ||
🏦 *Depósito Realizado* 🏦 | ||
💰 *Cantidad Depositada*: ${depositAmount} oro | ||
👤 *Saldo Actual en la Bóveda*: ${user.bank} oro | ||
Gracias por depositar en tu bóveda. ¡Tu oro está seguro con nosotros! 💼✨ | ||
`.trim(); | ||
|
||
try { | ||
const imgUrl = 'https://i.imgur.com/P3u2et7.jpg'; | ||
const responseImg = await axios.get(imgUrl, { responseType: 'arraybuffer' }); | ||
await conn.sendFile(m.chat, responseImg.data, "thumbnail.jpg", message, m); | ||
} catch (e) { | ||
await conn.reply(m.chat, message, m); | ||
} | ||
} | ||
|
||
handler.help = ['depositar']; | ||
handler.tags = ['economy']; | ||
handler.command = ['depositar', 'dep']; | ||
|
||
export default handler; | ||
|
||
// Ejemplo de uso | ||
// Comando: .depositar 100 | ||
// Texto: Realiza un depósito de 100 oro en tu bóveda. |