Skip to content

Commit

Permalink
REM-BOT
Browse files Browse the repository at this point in the history
  • Loading branch information
davidprospero123 authored Apr 15, 2024
1 parent d5014b6 commit b57e3af
Showing 1 changed file with 42 additions and 18 deletions.
60 changes: 42 additions & 18 deletions plugins/econ-deposit.js
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.

0 comments on commit b57e3af

Please sign in to comment.