From 9080fa3b69fb8bdd70c819fc555c014752e65ddd Mon Sep 17 00:00:00 2001 From: Snazzah Date: Wed, 12 Aug 2020 02:51:11 -0500 Subject: [PATCH] Add a confirmation on withdraw command --- src/commands/admin/withdraw.js | 6 +++++- src/structures/Command.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/commands/admin/withdraw.js b/src/commands/admin/withdraw.js index 3981542..091616e 100644 --- a/src/commands/admin/withdraw.js +++ b/src/commands/admin/withdraw.js @@ -25,11 +25,15 @@ module.exports = class Withdraw extends Command { 'There is not enough available LBC in the wallet to send that amount!'); // 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 transaction = await response.json(); if (await this.handleResponse(message, response, transaction)) return; 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}`); } diff --git a/src/structures/Command.js b/src/structures/Command.js index aa33817..44320b7 100644 --- a/src/structures/Command.js +++ b/src/structures/Command.js @@ -88,7 +88,7 @@ class Command { { message: 'Internal server error' } : json.error; console.error(`SDK error in ${this.name}:${message.author.id}`, response, error); 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 false;