A
A
anubis4652021-10-28 18:13:32
Node.js
anubis465, 2021-10-28 18:13:32

Why is args not defined?

Doesn't read args.

const SECRET_KEY = '**';
const QiwiBillPaymentsAPI = require('@qiwi/bill-payments-node-js-sdk');

 const qiwiApi = new QiwiBillPaymentsAPI(SECRET_KEY);


 const publicKey = '**';


module.exports = {
    run: async (client, message, args) => {
    const billId = args[0]
    const nick = message.content.split(" ").splice(2).join(" ")
    if (!billId) return message.channel.send("Вы не указали свой платежный ID!")
    if (!nick) return message.channel.send("Вы не указали свой платежный ID!")
    qiwiApi.getBillInfo(billId).then( data => {
        if(data.status.value = "PAID") return message.author.send("Успешно оплачено!")
        if(data.status.value = "WAITING") return message.author.send("Ваш счет ожидает оплаты!")
}
    )}}

module.exports.help = {
    name: "статус"
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Askar Familiev, 2015-01-22
@askarik

Here is a proven regular
expression ([a-zA-Z]+[a-zA-Z-']*)+
You can optimize it if necessary. This screen was made with PhpStorm, there is an opportunity to use a regular expression in the search / replacement, it always helps me. What is highlighted are those values ​​that fall under the regular expression

A
algebris, 2015-01-21
@algebris

/\w+([-']\w+)*/g
maybe something like this? possible names are not entirely clear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question