Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const balanceEnough = function(amt) {
- return new Promise(function(resolve,reject) {
- bot.chat('/bal');
- setInterval(() => {
- if(returned){
- if(amt === "all") {
- resolve(currentBalance);
- return;
- }
- if(currentBalance > amt) {
- returned = false;
- resolve(true)
- return;
- } else {
- returned = false;
- resolve(false)
- return;
- }
- }
- })
- //reject(new Error('lol wut'))
- })
- }
- if(m[0] === '!withdraw') {
- if(m.length) {
- if(isNaN(m[1])){
- if(m[1] === "all" || m[1] === "all."){
- let date_time = dtime();
- balanceEnough("all").then(function(amt){
- addHist(username, date_time[1], date_time[0], amt, "withdraw")
- setTimeout(() => {
- bot.chat('/pay ' + username + ' ' + amt)
- },500)
- })
- return;
- } else {
- bot.chat('/msg ' + username + " You did not provide a valid number.")
- }
- if(msg.includes('<!> Balance: $')){
- if(!msg.includes("*") && !msg.includes("-") && !msg.includes('[')){
- msg = msg.replace('<!> Balance: $', '').replace(/,/g, '');
- currentBalance = parseInt(msg);
- returned = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement