Ekonomi botumda cüzdan komutundaki veriler sıfırlanıyor

Katılım
23 Ocak 2024
Konular
1
Mesajlar
5
Tepki puanı
0
Puanları
355
V12 botumdaki tanımlı cüzdan kodu bu , bot çık gir yapınca kullanıcıların bakiyelerinin sıfırlanmamasını istiyorum nasıl yaparım

} else if (command === 'cüzdan') {
const user = getUser(message.author.id);
const userBalances = {};


if (user.money === 0) {
const zeroBalanceImageUrl = 'https://media.istockphoto.com/id/97...xWFqcjPKJLCgKlq8zUBysQjEK2EsXT30zvBNpD00bg=';
const embedZeroBalance = new Discord.MessageEmbed()
.setColor('#b0e0e6')
.setTitle('Cüzdan')
.setDescription('Paranız yok!')
.setImage(zeroBalanceImageUrl);

message.channel.send(embedZeroBalance);
return;
}


const canvas = createCanvas(400, 200);
const ctx = canvas.getContext('2d');


ctx.fillStyle = '#eee685';
ctx.fillRect(0, 0, 400, 200);


ctx.fillStyle = 'BLACK';
ctx.font = 'bold 20px Arial';
ctx.fillText('Cüzdan', 20, 30);


ctx.font = '16px Arial';
ctx.fillText(`MW Bakiyesi: ${user.money.toLocaleString()} MW`, 20, 70);



if (user.properties && user.properties.length > 0) {
const propertiesList = user.properties.map((property, index) => `${index + 1}. ${property.name}: ${property.value.toLocaleString()} MW`).join('\n');


ctx.font = '11px Arial';


ctx.fillText('Mülkler:', 20, 110);
ctx.fillText(propertiesList, 20, 120);
}


const customImageUrl = 'https://cdn.discordapp.com/attachme...3626737042d931daca182ddfea6575c87d65957433&'; // Kullanmak istediğiniz özel resmin URL'si

async function drawCustomImage() {
const customImage = await loadImage(customImageUrl);
ctx.drawImage(customImage, 200, 0, 200, 200);


const attachment = new MessageAttachment(canvas.toBuffer(), 'cuzdan.png');
message.channel.send(attachment);
}

drawCustomImage();