F
F
falsescam2020-05-15 16:59:49
JavaScript
falsescam, 2020-05-15 16:59:49

How to push with an array?

vk.updates.hear(/-start/, async (context) => {
    if(admin.indexOf(context.senderId) === -1) {
        return //context.send('Вам не доступна эта команда! @id' + context.senderId)
    }
    var args = context.message.text.split(' ');
    var starts;
    args.shift()
    try {
        var response = await axios.get('', {
            params: {
                page: '',
                key: ',
                host: args[0],
                port: args[1],
                time: args[2],
                method: args[3]
            }
        })
            
        if(args[3] === 'stop') {
            return context.reply('Все Атаки на : ' + args[0] + ' Успешно остановлены!')
        }

        if(!args[0]) {
            return
        }
        if(!args[1]) {
            return
        }
        if(!args[2]) {
            return
        }
        if(!args[3]) {
            return
        }

        return context.reply('Атака Успешно Отправлена на : ' + args[0]);
            
    } catch(err) {
    }
    const response2 = vk.api.messages.delete({
        message_ids: context.id,
        delete_for_all: 1
    })
});


There is such a code how to make it so that when the command -start args args args args, the try command is added to an array or something like that, that is, this command can be used for example 3 times
That is,
var attacks = []:
attacks.push type He wrote 3 times and he doesn’t give more, after the stop command, for example, he returned 3 attacks to 0

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