cdevshop / tebex-bot

https://docs.cdev.shop/
https://cdev.shop/
MIT License
10 stars 6 forks source link

/lookup tranasction is not working if the Tbx ID is invalid #1

Open bestotssyn opened 1 year ago

bestotssyn commented 1 year ago

You can fix it by adding this in src/commands/tebex/lookup.js, right after:

const info = await getTransaction.json();

So after that line you add this:

if (info.packages === null || info.packages === undefined) { const errorEmbed = new EmbedBuilder() .setColor(0x0ab8f2) .setAuthor({ name: "Error"}) .setDescription(Transaction ID \${tid}` not found`); return await interaction.editReply({ embeds: [errorEmbed] }); }

it will make it so if the transaction ID is invalid it will return from the function and send an embed that the Transcation ID is invalid.

iiKline commented 1 year ago

Your fix didn't work for me

bestotssyn commented 1 year ago

You probably did something wrong, that makes it so if the request from Tebex's API return a nil value (basically if that transaction id doesn't exist, then it returns an embed that tells you that the transaction id is not found,