update commands
This commit is contained in:
parent
ce34ab6b85
commit
6745eeacf5
1 changed files with 13 additions and 11 deletions
|
@ -71,7 +71,7 @@ if(!fs.existsSync('./config/config.yml')) {
|
|||
|
||||
function replytweet(to, replyid, themessage) {
|
||||
winston.info('Preparing tweet' + '@' + to + ' :' + themessage);
|
||||
var newtweet = '@' + to + ' ' + themessage + ' (' + makeid() + ')';
|
||||
var newtweet = '@' + to + ' ' + themessage + ' \nMsg_ID:(' + makeid() + ')';
|
||||
winston.info('' + '@' + to + ' :' + newtweet);
|
||||
client.post('statuses/update', {status: newtweet, in_reply_to_status_id: replyid}, function (error, params, response) {
|
||||
if (error) {
|
||||
|
@ -173,7 +173,7 @@ if(!fs.existsSync('./config/config.yml')) {
|
|||
coin.getBalance(settings.rpc.prefix + from.toLowerCase(), settings.coin.min_confirmations, function (err, balance) {
|
||||
if (err) {
|
||||
locks[from.toLowerCase()] = null;
|
||||
winston.error('Error in !tip command.', err);
|
||||
winston.error('Error in tip command.', err);
|
||||
|
||||
replytweet(from, replyid, settings.messages.error.expand({name: from}));
|
||||
return;
|
||||
|
@ -182,8 +182,8 @@ if(!fs.existsSync('./config/config.yml')) {
|
|||
if (balance >= amount) {
|
||||
coin.send('move', settings.rpc.prefix + from.toLowerCase(), settings.rpc.prefix + to.toLowerCase(), amount, function (err, reply) {
|
||||
locks[from.toLowerCase()] = null;
|
||||
if (err || !reply) {
|
||||
winston.error('Error in !tip command', err);
|
||||
if (err || reply) {
|
||||
winston.error('Error in tip command', err);
|
||||
replytweet(from, replyid, settings.messages.error.expand({name: from}));
|
||||
return;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ if(!fs.existsSync('./config/config.yml')) {
|
|||
var user = from.toLowerCase();
|
||||
getAddress(user, function (err, address) {
|
||||
if (err) {
|
||||
winston.error('Error in !address command', err);
|
||||
winston.error('Error in address command', err);
|
||||
replytweet(from, replyid, settings.messages.error.expand({name: from}));
|
||||
return;
|
||||
}
|
||||
|
@ -214,14 +214,14 @@ if(!fs.existsSync('./config/config.yml')) {
|
|||
var user = from.toLowerCase();
|
||||
coin.getBalance(settings.rpc.prefix + user, settings.coin.min_confirmations, function (err, balance) {
|
||||
if (err) {
|
||||
winston.error('Error in !balance command', err);
|
||||
winston.error('Error in balance command', err);
|
||||
replytweet(from, replyid, settings.messages.error.expand({name: from}));
|
||||
return;
|
||||
}
|
||||
var balance = typeof (balance) == 'object' ? balance.result : balance;
|
||||
coin.getBalance(settings.rpc.prefix + user, 0, function (err, unconfirmed_balance) {
|
||||
if (err) {
|
||||
winston.error('Error in !balance command', err);
|
||||
winston.error('Error in balance command', err);
|
||||
replytweet(from, replyid, settings.messages.balance.expand({balance: balance, name: user}));
|
||||
return;
|
||||
}
|
||||
|
@ -235,20 +235,20 @@ if(!fs.existsSync('./config/config.yml')) {
|
|||
var user = from.toLowerCase();
|
||||
var match = message.match(/.?withdraw (\S+)$/);
|
||||
if (match == null) {
|
||||
replytweet(from, replyid, 'Usage: !withdraw <' + settings.coin.full_name + ' address>');
|
||||
replytweet(from, replyid, 'Usage: withdraw <' + settings.coin.full_name + ' address>');
|
||||
return;
|
||||
}
|
||||
var address = match[1];
|
||||
coin.validateAddress(address, function (err, reply) {
|
||||
if (err) {
|
||||
winston.error('Error in !withdraw command', err);
|
||||
winston.error('Error in withdraw command', err);
|
||||
replytweet(from, replyid, settings.messages.error.expand({name: from}));
|
||||
return;
|
||||
}
|
||||
if (reply.isvalid) {
|
||||
coin.getBalance(settings.rpc.prefix + from.toLowerCase(), settings.coin.min_confirmations, function (err, balance) {
|
||||
if (err) {
|
||||
winston.error('Error in !withdraw command', err);
|
||||
winston.error('Error in withdraw command', err);
|
||||
replytweet(from, replyid, settings.messages.error.expand({name: from}));
|
||||
return;
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ if(!fs.existsSync('./config/config.yml')) {
|
|||
}
|
||||
coin.sendFrom(settings.rpc.prefix + from.toLowerCase(), address, balance - settings.coin.withdrawal_fee, function (err, reply) {
|
||||
if (err) {
|
||||
winston.error('Error in !withdraw command', err);
|
||||
winston.error('Error in withdraw command', err);
|
||||
replytweet(from, replyid, settings.messages.error.expand({name: from}));
|
||||
return;
|
||||
}
|
||||
|
@ -290,6 +290,8 @@ if(!fs.existsSync('./config/config.yml')) {
|
|||
break;
|
||||
default:
|
||||
winston.warn("Invalid Command" + command);
|
||||
replytweet(from, replyid, 'Invalid command. Tweet "@LBC_TipBot lbryian help" for list of commands or see reply below')
|
||||
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue