S
S
Sergey Stadnik2020-06-05 20:07:17
JavaScript
Sergey Stadnik, 2020-06-05 20:07:17

How to make the bot process 2 messages?

How to do this:

Suppose a person writes:

get

bot replies:

"Enter user id"

The user writes:

1

and then the bot sends information about the user with the given id

of the "get" command constructor

spoiler
updates.hear(/get ([0-9]+)$/i,(context) => {
let platform = false
if(context.isChat) platform = true
let user = base.bs[base.id[context.senderId].id]
let nick = ``
if(user.nicknotify == false) {
  nick = `${base.bs[base.id[context.senderId].id].nick}`
}
if(user.nicknotify == true) {
  nick = `*id${context.senderId} (${base.bs[base.id[context.senderId].id].nick})`
}
let myclan = clan[base.bs[base.id[context.senderId].id].clan]
if(user.rank < 4) return
if(!base.bs[context.$match[1]]) return context.send(`${nick}, ид указан неверно! `)
let admtext = `${nick}, информация об игроке «*id${base.bs[context.$match[1]].id} (${base.bs[context.$match[1]].nick})»:`
let guser = base.bs[context.$match[1]]
let task = `` 
if(guser.carid > 0) {
  task += `\n⠀ Машина: ${guser.carname}`
}
if(guser.yachtid > 0) {
  task += `\n⠀ Яхта: ${guser.yachtname}`
}
if(guser.airplaneid > 0) {
  task += `\n⠀✈ Самолет: ${guser.airplanename}`
}
if(guser.helicopterid > 0) {
  task += `\n⠀ Вертолет: ${guser.helicoptername}`
}
if(guser.homeid > 0) {
  task += `\n⠀ Дом: ${guser.homename}`
}
if(guser.kvartiraid > 0) {
  task += `\n⠀ Квартира: ${guser.kvartiraname}`
}
if(guser.biznesid > 0) {
  task += `\n⠀ Бизнес: ${guser.biznesname}`
}
if(guser.petid > 0) {
  task += `\n⠀${guser.peticon} Питомец: ${guser.petname}`
}
if(guser.farmid > 0) { 
  if(guser.farmid == 1) task += `\n⠀ Ферма: ${guser.farmname} (x${utils.sp(guser.farms)})`
  if(guser.farmid == 2) task += `\n⠀ Ферма: ${guser.farmname} (x${utils.sp(guser.farms)})`
  if(guser.farmid == 3) task += `\n⠀ Ферма: ${guser.farmname} (x${utils.sp(guser.farms)})`
}
if(guser.phoneid > 0) {
  task += `\n⠀ Телефон: ${guser.phonename}`
}
let profile = `\n ID: ${base.id[guser.id].id}`
profile += `\n Ник: ${guser.nick}`
profile += `\n?? ВК ид: ${guser.id}`
if(guser.rank == 2) profile += `\n V.i.P игрок`
if(guser.rank == 3) profile += `\n Premium игрок`
if(guser.rank == 4) profile += `\n Модератор`
if(guser.rank > 4) profile += `\n Администратор`
profile += `\n Денег: ${utils.sp(guser.balance)}$`
if(guser.btc > 0) profile += `\n Биткоинов: ${utils.sp(guser.btc)}`
profile += `\n Рейтинг: ${utils.sp(guser.rating)}`
if(task !== ``) profile += `\n\n Имущество: ${task}`
if(guser.topenabled == true) profile += `\n Топ: Включен`
if(guser.topenabled == false) profile += `\n Топ: Выключен`
if(guser.bonus == 0) profile += `\n Бонус: Доступен`
if(guser.bonus !== 0) profile += `\n Бонус: Недоступен`
if(guser.notifications == true) profile += `\n Уведомления: Включены`
if(guser.notifications == false) profile += `\n Уведомления: Выключены`
if(guser.longnick == true) profile += `\n✍️ Длинный ник: Включен`
if(guser.longnick == false) profile += `\n✍️ Длинный Ник: Выключен`
profile += `\n Дата регистрации: ${guser.reg}`
if(guser.payban == true) profile += `\n⛔ Бан передачи: Есть`
if(guser.payban == false) profile += `\n⛔ Бан передачи: Нет`
profile += `\n➡️ Последний раз передавал: ${guser.lastpay}`
profile +=`\n Передал: ${guser.payalltime}`
if(guser.reportban == true) profile += `\n Бан репорта: Есть`
if(guser.reportban == false) profile += `\n Бан репорта: Нет`
if(guser.banned == false) profile += `\n❎ Забанен: Нет`
if(guser.banned == true) profile += `\n❎ Забанен: Да`
profile += `\n⌚Последняя активнось: ${guser.lastactivity}`
return context.send({message: `${admtext} ${profile}`
})
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
2
2CHEVSKII, 2020-06-05
@nuriboy

For each user, save the state, what question he asked, and process it based on this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question