M
M
MrMim2020-09-29 23:22:46
Node.js
MrMim, 2020-09-29 23:22:46

How to remove part of a kiwi comment?

there is a code:

setInterval(() => {
Wallet.getOperationHistory({rows: 5, operation: "IN"}, (err, operations) => {
for(i in operations['data']){
if(operations['data'][i]['comment'] == `game|${user.id}` & !txns.find(x => x.txnId === operations['data'][i]['txnId'])){
txns.push({
amount: operations['data'][i]['total']['amount'],
txnId: operations['data'][i]['txnId']
})
if ((operations['data'][i]['sum']['currency']) != 643) return;
if (info[0].buy == 0) return;
const vivod = Number(operations['data'][i]['sum']['amount'] / Number(info[0].buy) * 1000000);
const com = operations['data'][i]['comment'];
let idusr = com.split('|');
db.get().collection('users').updateOne({ uid: Number(idusr) }, { $inc: { test1: +Math.floor(vivod) } });
vk.get()._vk.api.call("messages.send", {
peer_id: operations['data'][i]['comment'] ,
random_id: util.random(-200000000, 200000000),
message: `✅ На ваш бонусный баланс зачислено: ${Math.floor(vivod)} коинов.`
}).catch((err) => { console.log(`Ошибка при отправлке сообщения ${err}`); });
vk.get()._vk.api.call("messages.send", {
peer_id: 521577793 ,
random_id: util.random(-200000000, 200000000),
message: `✅ Игрок @id${operations['data'][i]['comment']} купил ${Math.floor(vivod)} бонусных коинов.`
}).catch((err) => { console.log(`Ошибка при отправлке сообщения ${err}`); });
}
}
});
}, 2000);


and it checks the comment game|37284773 how to remove 'game|' and leave only 37284773 ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question