mirror of
https://github.com/LBRYFoundation/curate.git
synced 2025-08-23 17:37:25 +00:00
Fixed typo in deleteAccount, Added Fund command
This commit is contained in:
parent
456a50d868
commit
15e871f670
3 changed files with 82 additions and 46 deletions
|
@ -18,7 +18,7 @@ module.exports = class DeleteAccount extends Command {
|
|||
if (account.accountID) {
|
||||
const supportsCount = await Util.LBRY.getSupportsCount(this.client, account.accountID);
|
||||
if (!await this.client.messageAwaiter.confirm(message, {
|
||||
header: `Are you sure you delete that account? *(${supportsCount.toLocaleString()} support[s])*`
|
||||
header: `Are you sure you want to delete that account? *(${supportsCount.toLocaleString()} support[s])*`
|
||||
})) return;
|
||||
await Util.LBRY.deleteAccount(this.client, discordID, account.accountID);
|
||||
return message.channel.createMessage('Deleted account.');
|
||||
|
|
36
src/commands/admin/fund.js
Normal file
36
src/commands/admin/fund.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
const Command = require('../../structures/Command');
|
||||
const Util = require('../../util');
|
||||
|
||||
module.exports = class FundAccount extends Command {
|
||||
get name() { return 'fundaccount'; }
|
||||
|
||||
get _options() { return {
|
||||
aliases: ['fund', 'fundacc'],
|
||||
permissions: ['admin'],
|
||||
minimumArgs: 2
|
||||
}; }
|
||||
|
||||
async exec(message, { args }) {
|
||||
const givenAmount = Util.LBRY.ensureDecimal(args[1]);
|
||||
if (!givenAmount)
|
||||
return message.channel.createMessage('The second argument must be a numeric amount of LBC to send!');
|
||||
const discordID = Util.resolveToUserID(args[0]);
|
||||
if (!discordID)
|
||||
message.channel.createMessage('That Discord user isn\'t valid.');
|
||||
const account = await Util.LBRY.findOrCreateAccount(this.client, discordID, true);
|
||||
if (!await this.client.messageAwaiter.confirm(message, {
|
||||
header: `Are you sure you want to fund this account? *(${givenAmount} LBC)*`
|
||||
})) return;
|
||||
const response = await this.client.lbry.fundAccount({to: account.accountID, amount: givenAmount});
|
||||
const transaction = await response.json();
|
||||
console.info('Funded account', account.result.id, transaction.result.txid);
|
||||
const txid = transaction.result.txid;
|
||||
return message.channel.createMessage(`Successfully funded account! https://explorer.lbry.com/tx/${txid}`);
|
||||
}
|
||||
|
||||
get metadata() { return {
|
||||
category: 'Admin',
|
||||
description: 'Funds a given Discord user\'s Curation account with the specified amount of LBC.',
|
||||
usage: '<id|@mention> <amount>'
|
||||
}; }
|
||||
};
|
Loading…
Add table
Reference in a new issue