mirror of
https://github.com/LBRYFoundation/curate.git
synced 2025-08-23 17:37:25 +00:00
Add a confirmation on withdraw command
This commit is contained in:
parent
a0fe4dc5fa
commit
9080fa3b69
2 changed files with 6 additions and 2 deletions
|
@ -25,11 +25,15 @@ module.exports = class Withdraw extends Command {
|
||||||
'There is not enough available LBC in the wallet to send that amount!');
|
'There is not enough available LBC in the wallet to send that amount!');
|
||||||
|
|
||||||
// Send to wallet
|
// Send to wallet
|
||||||
|
if (!await this.client.messageAwaiter.confirm(message, {
|
||||||
|
header: `Are you sure you want to send ${amount} to \`${args[1]}\`? ` +
|
||||||
|
`*(remaining: ${availableBalance - parseFloat(amount)})*`
|
||||||
|
})) return;
|
||||||
const response = await this.client.lbry.sendToWallet({ amount, to: args[1] });
|
const response = await this.client.lbry.sendToWallet({ amount, to: args[1] });
|
||||||
const transaction = await response.json();
|
const transaction = await response.json();
|
||||||
if (await this.handleResponse(message, response, transaction)) return;
|
if (await this.handleResponse(message, response, transaction)) return;
|
||||||
console.debug('withdrew from master wallet', transaction);
|
console.debug('withdrew from master wallet', transaction);
|
||||||
return message.channel.createMessage(`Sent ${parseFloat(amount)} LBC to ${args[1]}.\n` +
|
return message.channel.createMessage(`Sent ${amount} LBC to ${args[1]}.\n` +
|
||||||
`https://explorer.lbry.com/tx/${transaction.result.txid}`);
|
`https://explorer.lbry.com/tx/${transaction.result.txid}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Command {
|
||||||
{ message: 'Internal server error' } : json.error;
|
{ message: 'Internal server error' } : json.error;
|
||||||
console.error(`SDK error in ${this.name}:${message.author.id}`, response, error);
|
console.error(`SDK error in ${this.name}:${message.author.id}`, response, error);
|
||||||
await message.channel.createMessage(
|
await message.channel.createMessage(
|
||||||
`LBRY-SDK returned ${response.status} witn an error: \`${error.message}\``);
|
`LBRY-SDK returned ${response.status} with an error: \`${error.message}\``);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue