F
F
falsescam2020-05-15 06:24:20
JavaScript
falsescam, 2020-05-15 06:24:20

How to make a loop in try?

You need to make sure that Try: is used several times via args[4]
for example -start host.com 123 123 123 4 ( 4 is how many times requests should be sent )

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] === '') {
                    return context.send(' : ' + args[0]')
                }

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

                return context.send(' : ' + args[0]);
            
            } catch(err) {
            }
        })

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2020-05-15
@opium

Well odds from one to four

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question