M
M
meqy1qub2019-08-30 14:08:11
JavaScript
meqy1qub, 2019-08-30 14:08:11

Can't send a message to the conversation that a new promo code has been created?

vk.updates.hear(/^(?:--addpromo)\s?([0-9]+)?/i, message => {
  let user = acc.users[user_id(message.user)];
  if(user.level < 5) return message.send(`доступно с привилегии "Спец админ"`);
 	if(!message.$match[1]) return message.send(` » Укажите сумму для промокода`);  

 	var result  = '';
  let words  = '0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM';
  let max_position = words.length - 1;
  for( i = 0; i < 6; ++i ) {
    position = Math.floor ( Math.random() * max_position );
    result = result + words.substring(position, position + 1);
  }

  acc.promos[result] = {
    users: {},
    activ: 30,
    type: 1,
    balance: message.$match[1]
  }		
  
 	return ('message.send', {chat_id: c22,
  ` » Ловите промокод:\n » На 30 активаций | На ${message.$match[1]}₽\n » Введите: '!промокод ${result}'`);
  }});

Here is the source code. The promo code is generated, but the creation message is not sent to the conversation.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jolyguf, 2019-08-30
@jolyguf

Try like this:

return vk.api.call('message.send', {chat_id: 22,
  ` » Ловите промокод:\n » На 30 активаций | На ${message.$match[1]}₽\n » Введите: '!промокод ${result}'`);

If it does not work, then write in the comments.

M
meqy1qub, 2019-08-30
@meqy1qub

5d6985762458b344326184.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question